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

Script to Export Multiple PDFs at Once

Community Beginner ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Hi All

I’m trying to find out how to export two PDF's at once from Indesign CC. I'm aiming to get 1 PDFx-1a PDF (High res with crop and bleed) and 1 smallest File Size (Cropped, no marks)? Could you point me in the right direction or if anyone has a working script I could use that would be amazing. My brain is going to fall out my ears.

Many thanks

Rahul

TOPICS
Scripting

Views

15.1K

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
community guidelines
New Here ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Anyway to add to the script so that I can identify which page numbers I would like to print? The current script runs the entire document. IE: We save all the business cards for Company X into one file. When someone submits a business card order, we export the one name to pdf. 

Votes

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
community guidelines
New Here ,
Apr 16, 2020 Apr 16, 2020

Copy link to clipboard

Copied

The script works well to generate pdf-files.
But is it possible to create a jpeg within this script?
I need to create the following several times on a day of 1 InDesign document:
1 HiresPDF
1 Lowres pdf
1 jpeg
For the PDF files, the script works perfectly. But I also want to get a Jpeg file from my InDesign in the same script.

Votes

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
community guidelines
Participant ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

I'm no code monkey (below script is found on the interwebz), but add this to the end of the script to get a jpg:

 

var doc = app.activeDocument;

// Set JPEG export preferences
app.jpegExportPreferences.properties = {
   antiAlias: true,
   embedColorProfile: true,
   exportResolution: 72,
   // exportingSpread: true, // Uncomment if spreads
   jpegColorSpace: JpegColorSpaceEnum.rgb,
   jpegExportRange: ExportRangeOrAllPages.exportRange,
   jpegQuality: JPEGOptionsQuality.maximum,
   jpegRenderingStyle: JPEGOptionsFormat.baselineEncoding,
   useDocumentBleeds: false,
   simulateOverprint: false,
   pageString: "1" // Page(s) to export, must be a string
}

// Make a temporary file
var tempFile = File("E:/Dokumentexport/temp.jpg");

// Export an image of the page to disk
doc.exportFile(ExportFormat.jpg, tempFile);

 

Votes

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
community guidelines
Community Beginner ,
Apr 23, 2018 Apr 23, 2018

Copy link to clipboard

Copied

Thanks guys - Ariel your right I couldn't figure out the bit where I wanted to customise it.

Many thanks

Votes

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
community guidelines
Contributor ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

I hope this change in script will help you

d = app.activeDocument; preset1 = app.pdfExportPresets.itemByName("[PDF/X-1a:2001]"); preset2 = app.pdfExportPresets.itemByName("[Smallest File Size]"); 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 + "_LR.pdf"; name2 = thePath + "_HR.pdf" d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1); d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);

Votes

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
community guidelines
Community Expert ,
Apr 16, 2020 Apr 16, 2020

Copy link to clipboard

Copied

Hi Kepano70,

you say:

 

The script works well to generate pdf-files.
But is it possible to create a jpeg within this script?
I need to create the following several times on a day of 1 InDesign document:
1 HiresPDF
1 Lowres pdf
1 jpeg
For the PDF files, the script works perfectly. But I also want to get a Jpeg file from my InDesign in the same script.

 

Look into Peter Kahrel's Batch Process script where you can save settings:

Batch-process (convert/export/import) documents

https://creativepro.com/files/kahrel/indesign/batch_convert.html

 

Regards,
Uwe Laubender

( ACP )

 

 

Votes

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
community guidelines
New Here ,
Nov 04, 2024 Nov 04, 2024

Copy link to clipboard

Copied

Hey guys,

thank you for the great script!

I tried to use it for a jobOption that generate not one PDF of the whole data, it's generating a pdf for every page.
For the first jobOption it works, it gives a folder and puts in all pages in seperate pdf.
So far, so good.

But than he stops and gives this error 

Unbenannt.jpg

 

But this line is already successfull done.

The following line is:

d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);

d.exportFile(ExportFormat.PDF_TYPE, new File(name3), false, preset3);

 

 

This is the full script:

// BS"D

// All rights reserved (c) 2015 by Id-Extras.com

// Free to use and modify but do not delete this copyright attribution.

// This script will export 3 pdfs of the current document

// Choose the PDF presets by altering their names below

// The second PDF gets a suffix added to its name.

// Modify the line below beginning name2 = to change the suffix.

// For more InDesign scripts: www.Id-Extras.com

d = app.activeDocument;

// Here you can choose the PDF preset

preset1 = app.pdfExportPresets.itemByName("Schaeffler_HighRes_Einzelseiten");

preset2 = app.pdfExportPresets.itemByName("Schaeffler_LowRes_Einzelseiten");

preset3 = app.pdfExportPresets.itemByName("Schaeffler_LowRes_Einzelseiten");

preset4 = app.pdfExportPresets.itemByName("Schaeffler_LowRes");

if (!(preset1.isValid && preset2.isValid && preset3.isValid && preset4.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$/, "");

// Here you can set the suffix at the end of the name

name1 = thePath+"_HighRes.pdf";

name2 = thePath+"_LowRes.pdf";

name3 = thePath+"_master.pdf";

name4 = thePath+"_master_zusammen.pdf";

d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1);

d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);

d.exportFile(ExportFormat.PDF_TYPE, new File(name3), false, preset3);

d.exportFile(ExportFormat.PDF_TYPE, new File(name4), false, preset4);

 

 

I can't find the mistake 😕

Thank you for your help!

 

Kind Regards,

Toni

Votes

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
community guidelines
Community Expert ,
Nov 04, 2024 Nov 04, 2024

Copy link to clipboard

Copied

@ToniGl

 

What platform, OS and InDesign versions?

 

Votes

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
community guidelines
New Here ,
Nov 04, 2024 Nov 04, 2024

Copy link to clipboard

Copied

LATEST
Windows 11 and InDesign CC

Votes

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
community guidelines