Export multiPDF
Hello all,
I want to share with you a script i made with Chat GPT 😉 to export 2 pdf files from 1 indesign document.
I always need to export a pdf for print with cropmarks and a screenversion for preview.
Im not a javascript wizard but just ask Chat GPT to write the script for me ...and it worked.
If your in the same need of something like this see below script copy paste it to a txt file and save it like this "Multi_Export_pdf_Screen_Print.jsx"
maybe it's for javascript experts not a perfect script but for me it works great.
The script creates a folder called export on your desktop and places the 2 pdf files in there after that it closes the file. if you do not want to close just delete the last part in the script.
Hope i can make someone happy with this 😉 enjoy the day
----------------------------------------------------------------------------------
var exportFolder = Folder("~/Desktop/export");
if (!exportFolder.exists) exportFolder.create();
var baseName = app.activeDocument.name.split(".indd")[0];
var file1Name = baseName + " screen.pdf";
var file2Name = baseName + " print.pdf";
var file1Path = exportFolder + "/" + file1Name;
var file2Path = exportFolder + "/" + file2Name;
// Set the export presets
var presetFolder = Folder("URL here where you have your export profiles");
var preset1Name = "Name of profile1 you need to use";
var preset2Name = "Name of profile2 you need to use";
// Export the first PDF file
var preset1 = app.pdfExportPresets.itemByName(preset1Name);
if (!preset1.isValid) {
alert("The preset \"" + preset1Name + "\" is not available.");
} else {
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File(file1Path), false, preset1);
}
// Export the second PDF file
var preset2 = app.pdfExportPresets.itemByName(preset2Name);
if (!preset2.isValid) {
alert("The preset \"" + preset2Name + "\" is not available.");
} else {
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File(file2Path), false, preset2);
}
// Close the document
app.activeDocument.close(SaveOptions.NO);
----------------------------------------------------------------------------------------------
