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?
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);
Copy link to clipboard
Copied
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);