Copy link to clipboard
Copied
Hello, I am looking for an Indesign script that will export each page in a document to individual pdf files that are named with the placed image on each page. I was using a script that exported to jpgs, which worked great, but I need the exports to be PDFx4 print quality pdfs to retain the vector fonts in each one. Can anyone help me with this?
Copy link to clipboard
Copied
Did you try the following solution
Copy link to clipboard
Copied
Thanks @Charu Rajput I did already look at those options, but I'm looking for the saved files to be named the same name as the placed image on each page. Those options don't have that option.
Copy link to clipboard
Copied
Hello @bethl85705656,
I wrote an update to the script to export PDFx4 pdf's per you're request.
Note: the script will export the pdf's to a folder named "PDF" at the same root level as the InDesign document, there's no need to create the folder, as the script will if it doesn't exists.
var doc = app.activeDocument;
var docPages = doc.pages;
var PDF_Folder = Folder(doc.filePath + '/PDF');
if (!PDF_Folder.exists) {
PDF_Folder.create();
}
var export_preset = app.pdfExportPresets.item("[PDF/X-4:2008]");
if (!(export_preset.isValid)){
alert("The pdf export preset does not exist.");
exit();
}
for(p=0;p<docPages.length;p++){
var myPageItems = docPages[p].allPageItems
var myPageName = docPages[p].name;
for(i=0;i<myPageItems.length;i++){
//set selection as variable
var thisItem = myPageItems[i];
if(thisItem instanceof Rectangle || thisItem instanceof Polygon || thisItem instanceof Oval){
//get image within the frame
var myLinkedItem = thisItem.pageItems[0];
//get name of the linked image
var myLinkName = myLinkedItem.itemLink.name;
//strip extension from linked image name
var myLinkName = myLinkName.split('.')[0];
//export the pdfs
app.pdfExportPreferences.pageRange = doc.pages[p].name;
doc.exportFile(ExportFormat.PDF_TYPE, File(PDF_Folder + "/" + myLinkName + ".pdf"), false, export_preset);
}
}
}
alert("Done exporting PDF's!")
Regards,
Mike
Copy link to clipboard
Copied