Highlighted

Export PDF

New Here ,
Oct 06, 2020

Copy link to clipboard

Copied

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

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

TOPICS
Scripting

Views

105

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Export PDF

New Here ,
Oct 06, 2020

Copy link to clipboard

Copied

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

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

TOPICS
Scripting

Views

106

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2020 0
Explorer ,
Oct 06, 2020

Copy link to clipboard

Copied

hi, add this line to your code:

 

app.pdfExportPreferences.pageRange = '1-3'

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2020 0
Engaged ,
Oct 06, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2020 0
New Here ,
Oct 06, 2020

Copy link to clipboard

Copied

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

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

 

Claire.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2020 0