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

tiff to pdf converter

Participant ,
Nov 21, 2021 Nov 21, 2021

Copy link to clipboard

Copied

Hi Good day,

Thousands of tiff files available
it is necessary to convert them to two-page pdfs 

Automation-Scripting I look forward to your help and opinions on this matter .

Thanks

sample.png

TOPICS
Actions and scripting , macOS , Windows

Views

1.5K

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

correct answers 1 Correct answer

Community Expert , Nov 22, 2021 Nov 22, 2021

Let me know how this goes...

 

/* 

Batch x2 File Sets to Multi-page PDF.jsx

tiff to pdf converter
https://community.adobe.com/t5/photoshop-ecosystem-discussions/tiff-to-pdf-converter/td-p/12540527

Stephen Marsh
22nd November 2021, Version 1.0
(Based on: Stack N Number of Docs to Layers.jsx)

Notes:
A minimum of 2 or more files per stack is required. The quantity of input files must be evenly divisible by the stack quantity.
This script assumes that input TIFF files from a single folder to be 
...

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 21, 2021 Nov 21, 2021

Copy link to clipboard

Copied

 

I have adjusted one of my existing file set scripts to use  .makePDFPresentation()  for a multi-page output...

 

(A): Where will the 2 page PDF file be saved? Same folder as originals (no GUI)? A named sub-folder in the original folder (no GUI)? A user defined location when the script is run (GUI)? Somewhere else?

 

(B): In your example filenames, what would the final PDF filename look like for the two output files?

 

i.e.:

Untitled-1_Untitled_2.pdf

Untitled-3_Untitled_4.pdf

etc?

 

Anything else?

 

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
Participant ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied


first of all you are amazing , thank you so much


(A) : To the same folder as the original


(B) : yes , it should definitely be like this

Untitled-1_Untitled_2.pdf

Untitled-3_Untitled_4.pdf

....

....


Thank you so much

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 ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

Let me know how this goes...

 

/* 

Batch x2 File Sets to Multi-page PDF.jsx

tiff to pdf converter
https://community.adobe.com/t5/photoshop-ecosystem-discussions/tiff-to-pdf-converter/td-p/12540527

Stephen Marsh
22nd November 2021, Version 1.0
(Based on: Stack N Number of Docs to Layers.jsx)

Notes:
A minimum of 2 or more files per stack is required. The quantity of input files must be evenly divisible by the stack quantity.
This script assumes that input TIFF files from a single folder to be alpha/numeric sorting, such as:
File-01.jpg File-02.jpg etc, FileA1.tif FileA2.tif etc...

*/

#target photoshop

if (!app.documents.length) {

    try {

        // Save and disable dialogs
        var restoreDialogMode = app.displayDialogs;
        app.displayDialogs = DialogModes.NO;

        // Main script function
        (function () {

            // Select the input folder
            var inputFolder = Folder.selectDialog('Please select the input folder with TIFF files to process:');
            if (inputFolder === null) return;

            // Limit the file format input to TIFF
            var fileList = inputFolder.getFiles(/\.(tif|tiff)$/i);

            // Force alpha-numeric list sort in reverse order
            fileList.sort().reverse();

            // Set quantity
            var setQty = 2;

            // Validate that the file list is not empty
            var inputCount = fileList.length;
            var cancelScript1 = (inputCount === 0);
            if (cancelScript1 === true) {
                alert('Zero input files found, script cancelled!');
                return;
            }

            // Validate the input count vs. output count - Thanks to Kukurykus for the advice to test using % modulus
            var cancelScript2 = !(inputCount % setQty);
            alert(inputCount + ' input files combined into sets of ' + setQty + ' will produce ' + inputCount / setQty + ' output files.');
            if (cancelScript2 === false) {
                alert('Script cancelled as the quantity of input files are not evenly divisible by the set quantity!');
                return;
            }

            // Set the output folder
            var outputFolder = inputFolder;

            // Loop through and open the file sets
            while (fileList.length) {

                // Sets quantity
                for (var a = 0; a < setQty; a++) {
                    try {
                        app.open(fileList.pop());
                    } catch (e) { }

                    // Remove document ancestors metadata
                    deleteDocumentAncestorsMetadata();

                    function deleteDocumentAncestorsMetadata() {
                        // https://prepression.blogspot.com/2017/06/metadata-bloat-photoshopdocumentancestors.html
                        if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
                        var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
                        xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");
                        app.activeDocument.xmpMetadata.rawData = xmp.serialize();
                    }
                }

                // Loop open files
                var openFiles = [];
                for (var a = 0; a < app.documents.length; a++) {
                    openFiles.push(app.documents[a].fullName);
                }

                // Doc name parts
                var docOne = app.documents[0].name.replace(/\.[^\.]+$/, '');
                var docTwo = app.documents[1].name.replace(/\.[^\.]+$/, '');

                // Save location and file name
                var saveFile = File(outputFolder + '/' + docOne + '_' + docTwo + '.pdf');

                // PDF options
                var pdfPresOptions = new PresentationOptions();
                pdfPresOptions.presentation = false;

                // Save the file pairs as a multi-page PDF
                app.makePDFPresentation(openFiles, saveFile, pdfPresOptions);

                // Close all open docs without saving
                while (app.documents.length) {
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                }

            }

            // Restore saved dialogs
            app.displayDialogs = restoreDialogMode;

            // End of script notifications
            app.beep();
            var outputList = outputFolder.getFiles(/\.pdf$/i);
            alert('Script completed!' + '\n' + outputList.length + ' multi-page PDF files saved to:' + '\n' + outputFolder.fsName);

            // Open the output folder in the Finder or Explorer
            outputFolder.execute();

        }());

    } catch (e) {
        // Restore saved dialogs
        app.displayDialogs = restoreDialogMode;
        alert("Oops! Something went wrong...");
    }

} else {
    alert('Batch x2 File Sets to Multi-page PDF:' + '\n' + 'Please close all open documents before running this script!');
}

 

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
Participant ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

you are great , you are great
thank you so much, thanksssss

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 ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

You're welcome!

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 ,
Dec 14, 2021 Dec 14, 2021

Copy link to clipboard

Copied

LATEST

This version of the previous script uses ZIP compression and offers a few more possibilities:

 

/* 

Batch x2 File Sets to Multi-page PDF v2.jsx

tiff to pdf converter
https://community.adobe.com/t5/photoshop-ecosystem-discussions/tiff-to-pdf-converter/td-p/12540527

Stephen Marsh
14th December 2021, Version 1.0
(Based on: Stack N Number of Docs to Layers.jsx)

Notes:
A minimum of 2 or more files per stack is required. The quantity of input files must be evenly divisible by the stack quantity.
This script assumes that input TIFF files from a single folder to be alpha/numeric sorting, such as:
File-01.jpg File-02.jpg etc, FileA1.tif FileA2.tif etc...

*/

#target photoshop

if (!app.documents.length) {

    try {

        // Save and disable dialogs
        var restoreDialogMode = app.displayDialogs;
        app.displayDialogs = DialogModes.NO;

        // Main script function
        (function () {

            // Select the input folder
            var inputFolder = Folder.selectDialog('Please select the input folder with TIFF files to process:');
            if (inputFolder === null) return;

            // Limit the file format input to TIFF
            var fileList = inputFolder.getFiles(/\.(tif|tiff)$/i);

            // Force alpha-numeric list sort in reverse order
            fileList.sort().reverse();

            // Set quantity
            var setQty = 2;

            // Validate that the file list is not empty
            var inputCount = fileList.length;
            var cancelScript1 = (inputCount === 0);
            if (cancelScript1 === true) {
                alert('Zero input files found, script cancelled!');
                return;
            }

            // Validate the input count vs. output count - Thanks to Kukurykus for the advice to test using % modulus
            var cancelScript2 = !(inputCount % setQty);
            alert(inputCount + ' input files combined into sets of ' + setQty + ' will produce ' + inputCount / setQty + ' output files.');
            if (cancelScript2 === false) {
                alert('Script cancelled as the quantity of input files are not evenly divisible by the set quantity!');
                return;
            }

            // Set the output folder
            var outputFolder = inputFolder;

            // Loop through and open the file sets
            while (fileList.length) {

                // Sets quantity
                for (var a = 0; a < setQty; a++) {
                    try {
                        app.open(fileList.pop());
                    } catch (e) {}

                    // Remove document ancestors metadata
                    deleteDocumentAncestorsMetadata();

                    function deleteDocumentAncestorsMetadata() {
                        // https://prepression.blogspot.com/2017/06/metadata-bloat-photoshopdocumentancestors.html
                        if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
                        var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
                        xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");
                        app.activeDocument.xmpMetadata.rawData = xmp.serialize();
                    }
                }

                // Loop open files
                var openFiles = [];
                for (var a = 0; a < app.documents.length; a++) {
                    openFiles.push(app.documents[a].fullName);
                }

                // Doc name parts
                var docOne = app.documents[0].name.replace(/\.[^\.]+$/, '');
                var docTwo = app.documents[1].name.replace(/\.[^\.]+$/, '');

                // Action Manager code - PDF options
                /* https://community.adobe.com/t5/photoshop-ecosystem-discussions/make-the-pdf-presentation-with-unsaved-open-document/td-p/10553160 */
                var d = new ActionDescriptor();
                var list = new ActionList();
                for (var a = 0; a < app.documents.length; a++) list.putString(app.documents[a].name);
                d.putList(stringIDToTypeID("filesList"), list);
                d.putPath(stringIDToTypeID("to"), new File(outputFolder + '/' + docOne + '_' + docTwo + '.pdf'));
                /*
                // Presentation options
                d.putBoolean(stringIDToTypeID("includeAnnotations"), true);
                d.putEnumerated(stringIDToTypeID("backgroundColor"), stringIDToTypeID("backgroundColor"), stringIDToTypeID("white"));
                d.putBoolean(stringIDToTypeID("autoAdvance"), true);
                d.putInteger(stringIDToTypeID("autoAdvanceSeconds"), 5);
                d.putBoolean(stringIDToTypeID("loop"), true);
                d.putEnumerated(stringIDToTypeID("transition"), stringIDToTypeID("transition"), stringIDToTypeID("random"));
                */
                /* https://theiviaxx.github.io/photoshop-docs/Photoshop/MagnificationType.html#magnificationtype */
                d.putBoolean(stringIDToTypeID("presentation"), false); // true = presentation | false = multi-page
                var d1 = new ActionDescriptor();
                // var idpdfPresetFilename = stringIDToTypeID( "pdfPresetFilename" );
                // d1.putString( idpdfPresetFilename, """High Quality Print""" );
                d1.putBoolean(stringIDToTypeID("pdfPreserveEditing"), false);
                d1.putBoolean(stringIDToTypeID("pdfViewAfterSave"), false);
                // d1.putInteger(stringIDToTypeID("pdfCompressionType"), 12); // JPEG Quality level
                var idpdfCompressionType = stringIDToTypeID("pdfCompressionType");
                d1.putInteger(idpdfCompressionType, 65540); // ZIP compression
                var idpdfDownSample = stringIDToTypeID("pdfDownSample");
                var idnone = stringIDToTypeID("none");
                d1.putEnumerated(idpdfDownSample, idpdfDownSample, idnone);
                d.putObject(stringIDToTypeID("as"), stringIDToTypeID("photoshopPDFFormat"), d1);
                executeAction(stringIDToTypeID("PDFExport"), d, DialogModes.NO);

                // Close all open docs without saving
                while (app.documents.length) {
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                }

            }

            // Restore saved dialogs
            app.displayDialogs = restoreDialogMode;

            // End of script notifications
            app.beep();
            var outputList = outputFolder.getFiles(/\.pdf$/i);
            alert('Script completed!' + '\n' + outputList.length + ' multi-page PDF files saved to:' + '\n' + outputFolder.fsName);

            // Open the output folder in the Finder or Explorer
            outputFolder.execute();

        }());

    } catch (e) {
        // Restore saved dialogs
        app.displayDialogs = restoreDialogMode;
        alert("Oops! Something went wrong...");
    }

} else {
    alert('Batch x2 File Sets to Multi-page PDF:' + '\n' + 'Please close all open documents before running this script!');
}

 

 

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 ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

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
Participant ,
Nov 27, 2021 Nov 27, 2021

Copy link to clipboard

Copied

teacher , script
are these possible

 

Compress :jpeg
Jpeg Quality :75%

Viewer :
Fit one full page

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 ,
Nov 27, 2021 Nov 27, 2021

Copy link to clipboard

Copied


@idjev wrote:

teacher , script
are these possible

 

Compress :jpeg
Jpeg Quality :75%

Viewer :
Fit one full page


 

 

The following options work:

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/PresentationOptions.html#presentationoptions

 

I have not been able to get general PDF options to work, as per the <placeholder> topic above that has not had any replies.

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
Participant ,
Nov 28, 2021 Nov 28, 2021

Copy link to clipboard

Copied

i solved the problem :  Action Wizard

thanks for everything

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 ,
Nov 28, 2021 Nov 28, 2021

Copy link to clipboard

Copied

So, you are using Acrobat Pro to reprocess the multi page Photoshop PDF files?

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
Participant ,
Nov 28, 2021 Nov 28, 2021

Copy link to clipboard

Copied

Yes ,  Acrobat Pro tool Action Wizard

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