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!

TIFF to PDF conver


idjev

Member
Messages
10
Likes
0
Hi Good day,

Thousands of tiff files available
it is necessary to convert them to two-page pdfs (archives 54000 .tif => 27000 .pdf)

I look forward to your help and opinions on this matter .
Thanks
 

JeffK

Guru
Messages
2,486
Likes
2,890
If I had to make the decision for myself, I'd go straight to Adobe Acrobat. It'll cost but you can pay for only a month at a time or sign up for a year subscription. There is a trial but don't know if it will allow you to save your documents.

 

idjev

Member
Messages
10
Likes
0
If I had to make the decision for myself, I'd go straight to Adobe Acrobat. It'll cost but you can pay for only a month at a time or sign up for a year subscription. There is a trial but don't know if it will allow you to save your documents.

Acrobat Pro DC how automation ??
 

thebestcpu

Guru
Messages
2,988
Likes
2,747
Hi Good day,

Thousands of tiff files available
it is necessary to convert them to two-page pdfs (archives 54000 .tif => 27000 .pdf)

I look forward to your help and opinions on this matter .
Thanks
Hi @idjev
Before going to far into options, just trying to understand the end desired result a bit better. You used the word "Archives" in your first post. That could imply that you want the best final and best quality image stored in PDF. Or maybe you just need all the images stored in PDF for viewing by those via a PDF reader.
If it is the later case, there is less of a concern on settings.
Yet if you are looking to archive the best long term image for possible re-editing in the future, then there could be an issue. Converters to PDF don't necessarily maintain 16 bit depth, full resolution etc etc.

So just a suggestion: If you could explain the end purpose for the 2 page individual PDF files for all of these images then you might get more in-depth thoughts from forum members on how to meet that need.

Just wanted to make sure you were aware that images can be modified many ways on their way into PDF and making sure those settings in the PDF creation process could be very important for you

John Wheeler
 

thebestcpu

Guru
Messages
2,988
Likes
2,747
Hi @idjev
While you are considering my immeidate post above, here are the steps that would do the job in Adobe Acrobat Pro DC (many versions can do this)

First create one PDF file from many TIFF files. Given the number of TIFF files, you may want to do this in batches of smaller number of TIFF files if necessary. Here is a screen shot of the command that can be used:

Screen Shot 2021-11-21 at 10.02.37 PM.png


Then agina in Adobe Acrobat Pro you use the Organize Pages Tool and use the Split command. You select splitting the file 2 pages at a time. It will give you options on how the files are labeld and where they can be put. Here is a screen shot:

Screen Shot 2021-11-21 at 10.10.27 PM.png


I think those two steps would do it for you.
Hope you find this helpful
John Wheeler
 

idjev

Member
Messages
10
Likes
0
Hi @idjev
Before going to far into options, just trying to understand the end desired result a bit better. You used the word "Archives" in your first post. That could imply that you want the best final and best quality image stored in PDF. Or maybe you just need all the images stored in PDF for viewing by those via a PDF reader.
If it is the later case, there is less of a concern on settings.
Yet if you are looking to archive the best long term image for possible re-editing in the future, then there could be an issue. Converters to PDF don't necessarily maintain 16 bit depth, full resolution etc etc.

So just a suggestion: If you could explain the end purpose for the 2 page individual PDF files for all of these images then you might get more in-depth thoughts from forum members on how to meet that need.

Just wanted to make sure you were aware that images can be modified many ways on their way into PDF and making sure those settings in the PDF creation process could be very important for you

John Wheeler

Thank you very much for your warnings, these issues were not ignored in the project.
 

thebestcpu

Guru
Messages
2,988
Likes
2,747
You're welcome @idjev
It was a learning process for me too. I have access to Acrobat Pro yet have only used it for specific needs so my breadth of knowledge on this tool is pretty limited compared to its capabilities.
Best of skill on your project
John Wheeler
 

MarshySwamp

Active Member
Messages
34
Likes
10
My solution was here:

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

JavaScript:
/*

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!');
}
 

Dormeur74

Power User
Messages
204
Likes
180
Just a trial. You put the following script (JSX) where you want ("C:\Test" for instance) on your HDD (not in your PS folder) and you execute it.
The subfolder C:\Test\PDF\ will be created. Your PDF files will be saved there.

// ************************* 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;
var pdfNum = 0;
var pdfName = "doc";
var fileName = "";

// 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);
var dossierIn = Folder('/d/_Res_Photografica-a-traiter/numeros/001');
outFolder = Folder(dossier + "/PDF");
if (!outFolder.exists) outFolder.create();

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

// Traitement
for (var i= 0;i<fileList.length;i+=2) {
// Sauvegarde au format PSD
var docRef = open(fileList);
var docName = docRef.name.substring( 0, docRef.name.indexOf('.') );
var pageWidth = docRef.width * 2;
var pageHeight = docRef.height;
docRef.selection.selectAll();
docRef.selection.copy();
docRef.close(SaveOptions.DONOTSAVECHANGES);
var docRef = app.documents.add(pageWidth, pageHeight,300, docName,NewDocumentMode.RGB);
docRef.paste();
docRef.activeLayer.translate (- pageWidth/4,0);
var rightPage = open(fileList[i+1]);
rightPage.selection.selectAll();
rightPage.selection.copy();
rightPage.close(SaveOptions.DONOTSAVECHANGES);
docRef.paste();
docRef.activeLayer.translate (pageWidth/4,0);
docRef.flatten();
convertPDF();
pdfNum+=1;
fileName = pdfName + pdfNum;
docRef.saveAs(File(outFolder + '/' + fileName + ".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 );
}

 

Dormeur74

Power User
Messages
204
Likes
180
Excuse-me, this script is better :
// ************************* 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;
var pdfNum = 0;
var pdfName = "doc";
var fileName = "";

// 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(/\.(tif|)$/i);
// No photos found : stop
if (fileList.length==0)
{
fileFound = false;
return;
}

// Traitement
for (var i= 0;i<fileList.length;i+=2) {
// Sauvegarde au format PSD
var docRef = open(fileList);
var docName = docRef.name.substring( 0, docRef.name.indexOf('.') );
var pageWidth = docRef.width * 2;
var pageHeight = docRef.height;
docRef.selection.selectAll();
docRef.selection.copy();
docRef.close(SaveOptions.DONOTSAVECHANGES);
var docRef = app.documents.add(pageWidth, pageHeight,300, docName,NewDocumentMode.RGB);
docRef.paste();
docRef.activeLayer.translate (- pageWidth/4,0);
var rightPage = open(fileList[i+1]);
rightPage.selection.selectAll();
rightPage.selection.copy();
rightPage.close(SaveOptions.DONOTSAVECHANGES);
docRef.paste();
docRef.activeLayer.translate (pageWidth/4,0);
docRef.flatten();
convertPDF();
pdfNum+=1;
fileName = pdfName + pdfNum;
docRef.saveAs(File(outFolder + '/' + fileName + ".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 );
}

 

Top