skip to Main Content

I have 100 PSD files with different content and another 1 separate psd file that want to combine in two-side PDF document (Front and Back).

It’s for print. I want to Automate process because the files are many. So, for example let’s say that for the first (front page) I have 100 PSDs with different image inside for example: (in PSD-01 – > img-01), (in PSD-02 -> img-02), … and the second page (the BACK) is the same for all Front Pages. For example PSD1 must combine with Back PSD, PSD2 must combine with BACK PSD and etc…

How can I automate this process in Photoshop, or InDesign, or other program, so when created files to have 100 Double-Sided PDFs with Different first (front) page and the same second (back) page? Thanks.

2

Answers


  1. You can automate it with Photoshop scripting:
    Say you have your pageA and pageB as .png files.

    // Switch off any dialog boxes
    displayDialogs = DialogModes.NO; // OFF 
    
    // you need to change these!!!!
    var frontPage = "D:\temp\process_images\page_A.png"; 
    var backPage  = "D:\temp\process_images\page_B.png";
    var myPDF = "D:\temp\process_images\myPDF.pdf";
    
    
    // =======================================================
    var idPDFExport = stringIDToTypeID( "PDFExport" );
    var desc6139 = new ActionDescriptor();
    var idflst = charIDToTypeID( "flst" );
    var list844 = new ActionList();
    list844.putPath( new File( frontPage) );
    list844.putPath( new File( backPage ) );
    desc6139.putList( idflst, list844 );
    var idT = charIDToTypeID( "T   " );
    desc6139.putPath( idT, new File( myPDF ) );
    var idBckC = charIDToTypeID( "BckC" );
    var idBckC = charIDToTypeID( "BckC" );
    var idWht = charIDToTypeID( "Wht " );
    desc6139.putEnumerated( idBckC, idBckC, idWht );
    var idAs = charIDToTypeID( "As  " );
    var desc6140 = new ActionDescriptor();
    var idpdfPresetFilename = stringIDToTypeID( "pdfPresetFilename" );
    desc6140.putString( idpdfPresetFilename, """High Quality Print""" );
    var idpdfPreserveEditing = stringIDToTypeID( "pdfPreserveEditing" );
    desc6140.putBoolean( idpdfPreserveEditing, false );
    var idpdfCompressionType = stringIDToTypeID( "pdfCompressionType" );
    desc6140.putInteger( idpdfCompressionType, 7 );
    var idPhtP = charIDToTypeID( "PhtP" );
    desc6139.putObject( idAs, idPhtP, desc6140 );
    executeAction( idPDFExport, desc6139, DialogModes.NO );
    

    You just need to adjust the script so it loops over your 100 front images and then adds the same back page.

    Login or Signup to reply.
  2. Basically it can be done in InDesign with this script:

    var doc = app.activeDocument;
    if (doc.pages.length < 2) doc.pages.add();
    
    // put image on page 2
    var file = 'd:/temp/back_page.psd';
    place_image_on_page(file, doc.pages[1]);
    
    // get PSD files for page 1
    var files = Folder('d:/temp/front').getFiles('*.psd');
    var output_folder = Folder('d:/temp/pdf');
    
    // show progress bar
    var bar = new Window("palette", "Progress...");
    var stat = bar.add("statictext", undefined, "");
    var progressbar = bar.add("progressbar", [15,15,400,35], 0, 100);
    stat.characters = 50;
    bar.center();
    bar.show();
    
    // loop through the files
    for (var f in files) {
    
        // delete old and put new image on page 1
        try { doc.pages[0].rectangles[0].remove() } catch(e) {}
        place_image_on_page(files[f], doc.pages[0]);
    
        // export the doc in PDF
        var preset = app.pdfExportPresets.item("[High Quality Print]");
        var file_name = parseInt(f) + 1 + '.pdf';
        var pdf_file = File(output_folder + '/' + file_name);
    
        // update the progress bar
        progressbar.value = ++f/files.length*100;
        stat.text = 'Make ' + file_name;
        bar.update();
       
        doc.exportFile(ExportFormat.pdfType, pdf_file, false, preset);
    }
    
    bar.close()
    alert('Done!');
    
    // ----------------------------------------------------------------------------
    function place_image_on_page(file, page) {
        var img = page.place(File(file));
        doc.align(img, AlignOptions.HORIZONTAL_CENTERS, AlignDistributeBounds.PAGE_BOUNDS);
        doc.align(img, AlignOptions.VERTICAL_CENTERS, AlignDistributeBounds.PAGE_BOUNDS);
        img[0].parent.fit(FitOptions.FRAME_TO_CONTENT);
    }
    

    Put your files in these folders:

    d:/temp/back_page.psd — PSD for page 2 (back page)

    d:/temp/front/*.psd — PSD files for page 1 (front page)

    d:/temp/pdf/ — folder for PDF files

    Create empty InDesign document with correct size and run the script. It saves two-side PDFs in the folder d:/temp/pdf. Names of these pdf files will be 1.pdf, 2.pdf, 3.pdf etc.

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search