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

Export pages of Indesign document to individual PDFs named with placed image

Community Beginner ,
Oct 14, 2022 Oct 14, 2022

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?

TOPICS
Import and export , Scripting
219
Translate
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 ,
Oct 14, 2022 Oct 14, 2022
Translate
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 Beginner ,
Oct 14, 2022 Oct 14, 2022

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.

 

Translate
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
Advisor ,
Oct 14, 2022 Oct 14, 2022

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

Translate
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
Enthusiast ,
Nov 07, 2023 Nov 07, 2023
LATEST
JavaScript for InDesign exports pages using unique names drawn from each page's content. Video tutorial is Windows. Script works the same both macOS and Windows. This is an update to an earlier video: https://youtu.be/3ldKqt1p14k When I made the first video, users contacted me with ideas for more
Translate
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