What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Batch Process to PDF


knowoneuno

Well-Known Member
Messages
114
Likes
11
I have a project with a client, who wants me to convert his "log book" photos from jpegs to a pdf format.
I took about 80 photos of his aircraft log books as he is trying to sell his aircraft.

Can someone please suggest an "action" that I can make to batch process these photos? I don't want to
have to individually open up each photo and then "save as" a pdf......

I was thinking I could make an action for this, but when I tried, it wasn't successful.

Any help/suggestions would be greatly appreciated.

Thank you!
 
This can be done with actions as follows.

The Action:
1) open a file in PS (does not matter what image or type)
2) Create a new action, call it what ever you like eg. "ToPDF"
3) Click Record for your new action
4) Go to "File > Save As..." and under "Save as type:" select "Photoshop PDF" an click save (location of the save does not matter)
5) A save Adobe PDF windows will open and set the options you would like for the PDF. Compression, etc. (Personally I would deselect the 'Preserve Photoshop Editing Capabilities' check box), Click Save PDF.
6) Once saved, stop the recording of your PDF action.

Processing:
1) Go to File > Automate > Batch...
2) In the 'Play' Section, select the new ToPDF action we just created.
3) In the Source Section, Select the source folder of the images you would like to process.
4) In the Destination Section, Select the folder to output your new PDF files to.
5) IMPORTANT! Check the box 'Override Action "Save As" Commands'
6) Click 'OK' and the process should run as expected.

Hope this helps, let me know if you have any issues.
 
You create a JSX file with the following script, put it on your hard drive where you want and exécute it. It will create a subfolder in which PDF files will be saved.
Try it, feed bac will be appreciated for eventual corrections. Excuse my poor English.


/*************************************************************************************
Save a file as PDF - Michel Rohan - 30/12/2022
*************************************************************************************/

// ************************* BEGIN PROG ***************************************

#target photoshop // MAC Finder or WINDOWS Explorer
displayDialogs = DialogModes.NO; // Disables dialog boxes

var outFolder = Folder("");
var saveOptions = new PDFSaveOptions();
saveOptions.PDFCompatibility = PDFCompatibility.PDF15;
saveOptions.encoding = PDFEncoding.PDFZIP;
var fileFound = false;

// Go !
main();

if (fileFound) {
alert("End of script. Your files were saved in " + outFolder);
}
else {
alert("No photos found. Bye !");
}


function main() {
// The folder where the JSX file is
var myJSX = $.fileName;
var x1 = myJSX.length;
var script = myJSX.replace(/^.*[\\\/]/, '');
var x2 = script.length + 1;
// Creation of a save folder
var dossier = Folder(myJSX.substr(0,x1-x2));
var dossierIn = Folder.selectDialog("Sélectionnez le dossier contenant les photos à traiter. La sauvegarde se fera dans le dossier " + outFolder);
outFolder = Folder(dossier + "/PDF");
if (!outFolder.exists) outFolder.create();

var fileList = dossierIn.getFiles(/\.(jpg|)$/i);
// No photos found : stop
if (fileList.length==0)
{
fileFound = false;
return;
}

// Traitement
for (var i= 0;i<fileList.length;i++) {
// Sauvegarde au format PSD
var docRef = open(fileList);
var docName = docRef.name.substring( 0, docRef.name.indexOf('.') );
convertPDF();
docRef.saveAs(File(outFolder + '/' + docName + ".pdf"),saveOptions, true );
docRef.close(SaveOptions.DONOTSAVECHANGES);
}
fileFound = true;
}

function convertPDF() {
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc9 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc10 = new ActionDescriptor();
var idpdfPresetFilename = stringIDToTypeID( "pdfPresetFilename" );
desc10.putString( idpdfPresetFilename, "Qualité supérieure" );
var idpdfCompatibilityLevel = stringIDToTypeID( "pdfCompatibilityLevel" );
var idpdfCompatibilityLevel = stringIDToTypeID( "pdfCompatibilityLevel" );
var idpdfonethree = stringIDToTypeID( "pdf13" );
desc10.putEnumerated( idpdfCompatibilityLevel, idpdfCompatibilityLevel, idpdfonethree );
var idpdfCompressionType = stringIDToTypeID( "pdfCompressionType" );
desc10.putInteger( idpdfCompressionType, 7 );
var idpdfIncludeProfile = stringIDToTypeID( "pdfIncludeProfile" );
desc10.putBoolean( idpdfIncludeProfile, false );
var idPhtP = charIDToTypeID( "PhtP" );
desc9.putObject( idAs, idPhtP, desc10 );
}

 

Back
Top