• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JPG to Multi-Page PDF Script

New Here ,
Jan 31, 2017 Jan 31, 2017

Copy link to clipboard

Copied

Hi all,

I'm racking my brain trying to figure out how to create a single multi-page PDF file from a folder of JPGs..

File\Automate\PDF Presentation requires you to select files manually, which means it can't be made an action (as it remembers the file names in the action). I have tried using ScriptListener with this to get the coding, but can't figure it out, as it also contains the file names.

Can any kind soul point help me with scripting that would allow me to select a folder of images and output to a multi-page PDF?

Any help would be greatly appreciated!! I'm using CS6.

Thanks!

Jennifer

TOPICS
Actions and scripting

Views

361

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 31, 2017 Jan 31, 2017

Copy link to clipboard

Copied

This is a function I used in one of my scripts to make pdf's prrofs. In the loop on line 8, proof list is a list of files from a folder that the user selects.

function makePDF(){

try{

      var idPDFExport = stringIDToTypeID( "PDFExport" );

          var desc1 = new ActionDescriptor();

          var idflst = charIDToTypeID( "flst" );

              var list1 = new ActionList();

              for(var i=0;i<pdfProofList.length;i++){

                    list1.putPath( new File(pdfProofList ) );                   

                    }

          desc1.putList( idflst, list1 );

          var idT = charIDToTypeID( "T   " );

          desc1.putPath( idT, new File(proofFolder + "/" + proofName + '.pdf' ) );//proofFolder is the folder selected to save the pdf

          var idBckC = charIDToTypeID( "BckC" );

          var idBckC = charIDToTypeID( "BckC" );

          var idWht = charIDToTypeID( "Wht " );

          desc1.putEnumerated( idBckC, idBckC, idWht );

          var idAs = charIDToTypeID( "As  " );

              var desc2 = new ActionDescriptor();

              var idpdfPresetFilename = stringIDToTypeID( "pdfPresetFilename" );

              desc2.putString( idpdfPresetFilename, """High Quality Print""" );

              var idpdfPreserveEditing = stringIDToTypeID( "pdfPreserveEditing" );

              desc2.putBoolean( idpdfPreserveEditing, false );

              var idpdfCompressionType = stringIDToTypeID( "pdfCompressionType" );

              desc2.putInteger( idpdfCompressionType, 7 );

          var idPhtP = charIDToTypeID( "PhtP" );

          desc1.putObject( idAs, idPhtP, desc2 );

      executeAction( idPDFExport, desc1, DialogModes.NO );

      }

catch(e){}  

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2017 Jan 31, 2017

Copy link to clipboard

Copied

Thanks so much for the super quick response Chuck!

I'm still trying to wrap my head around scripting. Usually I'm able to eventually figure things out when I see a script in action and can cobble something together. I'm assuming this function is part of a larger script? I can't seem to make this work as is, and Photoshop is saying it is missing braces LOL! Are you able to provide any guidance?

Thanks,

Jennifer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2017 Jan 31, 2017

Copy link to clipboard

Copied

Yes, it is from a larger script: some 7,400 lines of code. It looks like I forgot the ending brace to the function. I'll edit my original post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

LATEST

Thanks Chuck.

I will try this and let you know!

Jennifer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines