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

Looking for a script for PDF creation

Community Beginner ,
Mar 07, 2024 Mar 07, 2024

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...

TOPICS
Scripting
422
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

correct answers 1 Correct answer

Community Expert , Mar 07, 2024 Mar 07, 2024
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);

 

 

Translate
Community Expert ,
Mar 07, 2024 Mar 07, 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?

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 ,
Mar 07, 2024 Mar 07, 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

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 ,
Mar 07, 2024 Mar 07, 2024

@sanders001 

 

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

 

RobertTkaczyk_0-1709821041303.png

 

You can ignore bottom part of the screen.

 

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 ,
Mar 07, 2024 Mar 07, 2024

Tanks for your answer – unfortunately, I am a Mac user, and you tool is a exe file, isn’t it?

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 ,
Mar 07, 2024 Mar 07, 2024
quote

Tanks for your answer – unfortunately, I am a Mac user, and you tool is a exe file, isn’t it?


By @sanders001

 

Yeah, it's an EXE so PC only.

 

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 ,
Mar 07, 2024 Mar 07, 2024

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

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 ,
Mar 07, 2024 Mar 07, 2024
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);

 

 

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 ,
Mar 07, 2024 Mar 07, 2024

Great, it works!

But: I'm wondering how to get the first dialog window to appear after choosing a folder – because sometimes I just need to output one of two pages as a PDF. To do this I have to enter into the first dialogue window.

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 ,
Mar 07, 2024 Mar 07, 2024
quote

Great, it works!

But: I'm wondering how to get the first dialog window to appear after choosing a folder – because sometimes I just need to output one of two pages as a PDF. To do this I have to enter into the first dialogue window.


By @sanders001

 

Change "false" to "true" in the last line - it will show PDF Export dialog. 

 

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 ,
Mar 07, 2024 Mar 07, 2024

Absolutely great! That’s it! Thank you so much indeed, this really helps me a lot!

Matthias

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 ,
Mar 07, 2024 Mar 07, 2024
LATEST
quote

Absolutely great! That’s it! Thank you so much indeed, this really helps me a lot!

Matthias


By @sanders001

 

You are welcome.

 

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 ,
Mar 07, 2024 Mar 07, 2024

@sanders001 

 

Can you be more specific with your requirements?

 

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