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

Overriding PDF export preset settings without overwriting

Contributor ,
Apr 10, 2016 Apr 10, 2016

Copy link to clipboard

Copied

Is it possible to write a script to export a PDF using an export preset as the basis and then just overriding a couple of settings? A bit like you normals would if you were doing it manually i.e. selecting a preset like [High Quality Print] and then turning off/on options like bleed and crop marks.

I thought something like this:

var document = app.activeDocument;

var targetPreset = app.pdfExportPresets.item(0); // [High Quality Print]

targetPreset.pdfExportPreferences.useDocumentBleedWithPDF = true;

targetPreset.pdfExportPreferences.cropMarks = true;

var folder = Folder().selectDlg();

var file = new File(folder + '/testfile.pdf');

document.exportFile(ExportFormat.PDF_TYPE, file, false, targetPreset);

But this actually modifies the [High Quality Print] preset. What I suppose I need to do is get the settings from the preset and copy them to the app.pdfExportPreferences settings and then run the export with out the preset argument.

Anybody done this before?

TOPICS
Scripting

Views

877

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 10, 2016 Apr 10, 2016

Copy link to clipboard

Copied

Well this appears to work! Anybody see a problem with me copying the properties from a PDFExportPreset object to the properties of the app.PDFExportPreferences object? The look about the same...

var document = app.activeDocument;

var highQualProperties = app.pdfExportPresets.item(0).properties; // [High Quality Print]

app.pdfExportPreferences.properties = highQualProperties;

app.pdfExportPreferences.useDocumentBleedWithPDF = true;

app.pdfExportPreferences.cropMarks = true;

var folder = Folder().selectDlg();

var file = new File(folder + '/testfile.pdf');

document.exportFile(ExportFormat.PDF_TYPE, file, false);

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 ,
Apr 10, 2016 Apr 10, 2016

Copy link to clipboard

Copied

LATEST

Hi McShaman,

You can try like this,

var document = app.activeDocument; 

app.pdfExportPreferences.useDocumentBleedWithPDF = true; 

app.pdfExportPreferences.cropMarks = true; 

 

var folder = Folder().selectDlg(); 

 

var file = new File(folder + '/testfile.pdf'); 

var targetPreset = app.pdfExportPresets.item(0); // [High Quality Print] 

document.exportFile(ExportFormat.PDF_TYPE, file, false, targetPreset); 

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