Skip to main content
Participating Frequently
February 23, 2023
Question

Export multiPDF

  • February 23, 2023
  • 2 replies
  • 611 views

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);

----------------------------------------------------------------------------------------------

This topic has been closed for replies.

2 replies

Peter Kahrel
Community Expert
Community Expert
February 27, 2023

It would be interesting to know what exactly you asked. Could you post that here?

Participating Frequently
February 27, 2023

no problem here is the question but without the actuall url 

------------------------------------------------------------------------------------------------------------------------------

Write an InDesign script to Export 2 separate .pdf files from an already open InDesign file use this 2 presets “Sheet CMYK Fiery - No Crops” and “Sheet CMYK Fiery” these 2 preset files are located in this directory “URL whwere files are locateds” Save the files from the preset "Sheet CMYK Fiery - No Crops" as filename + 1.pdf and save files from the preset “Sheet CMYK Fiery” as filename +2.pdf and save them al on the desktop in the folder export after completion close the file.

------------------------------------------------------------------------------------------------------------------------------

 

That's it 😉 this was after many other text test btw haha but at the end this one works. hope it answers youre question. the file names are the profiles nemes i have in my system

Robert at ID-Tasker
Legend
February 23, 2023

Looks nice and clean 😉