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

ExtendScript Syntax

Explorer ,
Jan 07, 2020 Jan 07, 2020

I want to script some settings for PDF export from InDesign.

 

But I'm running into syntax problems, the references I have don't show use cases of the code i want to use, so its hit and miss with the syntax

 


///PDF EXPORT SETTINGS///
app.pdfExportPreference.AcrobatCompatibility.ACROBAT_4;
app.pdfExportPreference.standardsCompliance(PDFXStandards.PDFX1A2001_STANDARD);
app.pdfExportPreference.effectivePDFDestinationProfile(PDFProfileSelector.USE_DOCUMENT);
app.pdfExportPreference.effectivePDFXProfile(PDFProfileSelector.USE_DOCUMENT);
app.pdfExportPreference.pdfColorSpace(PDFColorSpace.CMYK);
app.pdfExportPreference.subsetFontsBelow(0);
app.pdfExportPreference.useDocumentBleedWithPDF = true;

// Flatener Settings //
app.pdfExportPreference.appliedFlattenerPreset(HIGH_RESOLUTION);
app.pdfExportPreference.appliedFlattenerPreset.convertAllStrokesToOutlines = true;
app.pdfExportPreference.appliedFlattenerPreset.convertAllTextToOutlines = true;
app.pdfExportPreference.appliedFlattenerPreset.gradientAndMeshResolution(600);
app.pdfExportPreference.appliedFlattenerPreset.lineArtAndTextResolution(1200);

// Marks //
app.pdfExportPreference.colorBars = false;
app.pdfExportPreference.cropMarks = false;
app.pdfExportPreference.registrationMarks = false;
app.pdfExportPreference.pageInformationMarks = false;

// Bitmap Settings //
app.pdfExportPreference.colorBitmapCompression(BitmapCompression.ZIP);
app.pdfExportPreference.colorBitmapQuality(CompressionQuality.MAXIMUM);
app.pdfExportPreference.colorBitmapSampling(Sampling.NONE);
app.pdfExportPreference.grayscaleBitmapCompression(BitmapCompression.ZIP);
app.pdfExportPreference.grayscaleBitmapQuality(CompressionQuality.MAXIMUM);
app.pdfExportPreference.grayscaleBitmapSampling(Sampling.NONE);
app.pdfExportPreference.monochromeBitmapSampling(Sampling.NONE);

// Document Elements //
app.pdfExportPreference.compressTextAndLineArt = false;
app.pdfExportPreference.exportLayers = false;
app.pdfExportPreference.exportNonprintingObjects =false;
app.pdfExportPreference.exportWhichLayers(ExportLayerOptions.EXPORT_VISIBLE_PRINTABLE_LAYERS);
app.pdfExportPreference.includeBookmarks = false;
app.pdfExportPreference.includeHyperlinks = false;
app.pdfExportPreference.interactiveElementsOption(InteractiveElementsOptions.APPEARANCE_ONLY);

TOPICS
Scripting , SDK
837
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 , Jan 07, 2020 Jan 07, 2020

Use the following

app.pdfExportPreferences

Also i just noticed that you are setting values incorrectly. If you refer to the links i shared you would see that effectivePDFDestinationProfile is a property and not a method and hence you can't use the () syntax to assign it. For properties you use the = sign for assigning values and () are used for methods

Also if you notice then effectivePDFDestinationProfile is a readonly value so you can't set it directly.

 

-Manan

Translate
Community Expert ,
Jan 07, 2020 Jan 07, 2020

You did not tell what exactly is the error that you are getting, in order to look at what the properties are and what the possible values they can take look at the DOM reference

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPreference.html

 

Also you might want to use a pdf preset, look at it

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPreset.html

 

-Manan

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 ,
Jan 07, 2020 Jan 07, 2020

Hi Manan,

This is the error I'm getting

InDesign_PDF_export_script_error.PNG

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 ,
Jan 07, 2020 Jan 07, 2020
LATEST

Use the following

app.pdfExportPreferences

Also i just noticed that you are setting values incorrectly. If you refer to the links i shared you would see that effectivePDFDestinationProfile is a property and not a method and hence you can't use the () syntax to assign it. For properties you use the = sign for assigning values and () are used for methods

Also if you notice then effectivePDFDestinationProfile is a readonly value so you can't set it directly.

 

-Manan

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