Copy link to clipboard
Copied
What I have now roughly is as follows:
// Open a new document, store a reference to it
document = app.documents.add();
// Place graphic on page
var graphic = document.pages.item(0) .place(File("C:\input.ai"))[0];
// PSD/AI with only 1 layer may not have this property available
if(!graphic.graphicLayerOptions)
{
return;
}
var layerOptions = graphic.graphicLayerOptions;
// Iterate the layers and set every layer to visible.
for(i = 0; i < layerOptions.graphicLayers.count(); i++)
{
layerOptions.graphicLayers.item(i).currentVisibility = true;
}
// Export using predefined presets
var preset = app.pdfExportPresets.item("<export_preset>");
preset.exportGuidesAndGrids = true;
preset.exportLayers = true;
preset.exportNonprintingObjects = true;
preset.exportWhichLayers = ExportLayerOptions.EXPORT_ALL_LAYERS;
// Export the file.
document.exportFile(ExportFormat.pdfType, File("C:\result.pdf"), preset, false, "", true);
The problem is that none of the guide layers are visible, even though I'm toggling all layers on.
Any InDesign scripters know why this isn't doing what I think it should?
Have something to add?