Skip to main content
Participating Frequently
March 7, 2024
Answered

Looking for a script for PDF creation

  • March 7, 2024
  • 2 replies
  • 667 views

I am looking for a script or instructions for a script with which I can directly control or select a specific PDF setting (I would give the script a keyboard command). Unfortunately my scripting skills are extremely limited...

This topic has been closed for replies.
Correct answer Robert at ID-Tasker
quote

The script should really only call up the job option mentioned, that's all it needs to be able to do.


By @sanders001

 

Try this:

 

var myPDFExportPreset = app.pdfExportPresets.item("ml_PDF_Translation_Black");
var myFolder = Folder.selectDialog ('Choose a Folder');
var pdf = String (app.activeDocument.fullName).replace (/\.indd$/, ".pdf");
pdf = pdf.replace(app.activeDocument.filePath,"");
app.activeDocument.exportFile(ExportFormat.pdfType, File(myFolder + pdf), false, myPDFExportPreset);

 

 

2 replies

Robert at ID-Tasker
Legend
March 7, 2024

@sanders001 

 

Can you be more specific with your requirements?

 

Community Expert
March 7, 2024

Should be easy enough 
Do you want the same file name - do you need a prompt for the file name? 
Do you want it to save to the same folder as the InDesign file or a different folder?
Do you have PDF preset saved - and what is the name of your PDF preset so it can be selected when running the script?

Any other info you can give for this?

Participating Frequently
March 7, 2024

That sounds very promising!
To your questions:
1. Yes, the PDF should have the same file name as the InDesign file
2. The PDFs are stored in a different folder - but I can easily select the folder using a shortcut with DefaultFolder.
3. i have a preset for the PDF output: ml_PDF_Translation_Black

That’s it!

Thanks in advance for you efforts!

Matthias

Robert at ID-Tasker
Legend
March 7, 2024

@sanders001 

 

If you work on a PC - you can use free version of my tool:

 

 

You can ignore bottom part of the screen.