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

Export PDF

Explorer ,
Oct 06, 2020 Oct 06, 2020

Hello everyone,

 

I'm posting here because I really can't find a solution to my problem.
I have a 4 page indesign file and I would like to export from this document 4 pdf :

1 pdf with pages 1 and 3 in small definition
1 pdf with pages 1 and 3 in high definition
1 pdf with pages 2 and 4 in small definition
1 pdf with pages 2 and 4 in high definition

 

I have a script to save my document in several pdf's of different qualities, but I can't integrate a code to select that certain page. I have tried with colour labels but without success.

 

Here is the script I use to export my pdfs of different qualities.

d = app.activeDocument; 
// Here you can choose the PDF preset 
preset1 = app.pdfExportPresets.itemByName("Print");
preset2 = app.pdfExportPresets.itemByName("Web"); 

if (!(preset1.isValid && preset2.isValid)){ 
 alert("One of the presets does not exist. Please check spelling carefully."); 
 exit(); 
} 
if (d.saved){ 
 thePath = String(d.fullName).replace(/\..+$/, "") + ".pdf"; 
 thePath = String(new File(thePath).saveDlg()); 
} 
else{ 
 thePath = String((new File).saveDlg()); 
} 
thePath = thePath.replace(/\.pdf$/, ""); 
name1 = thePath+"_print.pdf"; 
name2 = thePath+"_web.pdf";  
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1); 
d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);

 

Thank you very much,

Claire

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

Advisor , Oct 06, 2020 Oct 06, 2020

Hello Claire!

Try this for your needs.....

you need to define your pdf names so they don't get over written and also define the page range for each pdf.

d = app.activeDocument; 
// Here you can choose the PDF preset 
preset1 = app.pdfExportPresets.itemByName("Print");
preset2 = app.pdfExportPresets.itemByName("Web"); 

if (!(preset1.isValid && preset2.isValid)){ 
 alert("One of the presets does not exist. Please check spelling carefully."); 
 exit(); 
} 
if (d.saved){ 
 thePath = String(d.fullName)
...
Translate
Participant ,
Oct 06, 2020 Oct 06, 2020

hi, add this line to your code:

 

app.pdfExportPreferences.pageRange = '1-3'

 

 

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 06, 2020 Oct 06, 2020

Hello Claire!

Try this for your needs.....

you need to define your pdf names so they don't get over written and also define the page range for each pdf.

d = app.activeDocument; 
// Here you can choose the PDF preset 
preset1 = app.pdfExportPresets.itemByName("Print");
preset2 = app.pdfExportPresets.itemByName("Web"); 

if (!(preset1.isValid && preset2.isValid)){ 
 alert("One of the presets does not exist. Please check spelling carefully."); 
 exit(); 
} 
if (d.saved){ 
 thePath = String(d.fullName).replace(/\..+$/, "") + ".pdf"; 
 thePath = String(new File(thePath).saveDlg()); 
} 
else{ 
 thePath = String((new File).saveDlg()); 
} 
thePath = thePath.replace(/\.pdf$/, ""); 
name1 = thePath+"_1&3_print.pdf"; 
name2 = thePath+"_1&3_web.pdf"; 
name3 = thePath+"_2&4_print.pdf"; 
name4 = thePath+"_2&4_web.pdf";

app.pdfExportPreferences.pageRange = "1,3";
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1); 
app.pdfExportPreferences.pageRange = "1,3";
d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);
app.pdfExportPreferences.pageRange = "2,4";
d.exportFile(ExportFormat.PDF_TYPE, new File(name3), false, preset1); 
app.pdfExportPreferences.pageRange = "2,4";
d.exportFile(ExportFormat.PDF_TYPE, new File(name4), false, preset2);

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
Explorer ,
Oct 06, 2020 Oct 06, 2020
LATEST

OMG !!! It's perfect ! Thank you so much for your help !!

You've just saved me days of work, you're great!

 

Claire.

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