1 person found this helpful
ExportFormat also has a PNG variant (ExportFormat.PNG_FORMAT), but if you want to know if it contains alpha transparency, you'll have to try it. There are no further parameters you can set.
(..several minutes later..)
And I just tried it myself. No: you cannot use it on "myDocument" (an entire document) -- only on "single" objects (a group is a single object).
But, Yes: the background is transparent.
Hmm could you give any example of code? According to the scripting reference there is nothing like "ExportFormat.PNG_FORMAT" - I cannot even find this in Google. On official Adobe webpage in the scripting reference I can find:
Name Description Value TAGGED_TEXT Exports to a tagged text file with a TXT extension. 1416066168 = 'Tgtx' PDF_TYPE Exports to PDF format. 1952403524 = 't_PD' EPS_TYPE Exports to EPS format. 1952400720 = 't_EP' RTF Exports to rich text format (RTF). 1381254688 = 'RTF ' SVG Exports to SVG format. 1398163232 = 'SVG ' SVG_COMPRESSED Exports to SVGZ format. 1398163267 = 'SVGC' TEXT_TYPE Exports to text (TXT) format. 1952412773 = 't_te' XML Exports the document's tagged content to XML. 1481460768 = 'XML ' JPG Exports to JPEG format. 1246775072 = 'JPG ' INDESIGN_INTERCHANGE Exports to InDesign Interchange (INX) format. 1229871136 = 'INX ' INDESIGN_SNIPPET Exports to InDesign Snippet (INDS) format. 1936617588 = 'snpt' INCOPY_CS_DOCUMENT Exports to InCopy CS document (INCD) format. 1702126436 = 'etcd' INCOPY_DOCUMENT Exports to InCopy document (INCX) format. 1702126456 = 'etcx'
var myDocument = app.documents.add();
g = myDocument.pages.item(0).groups.add (myDocument.pages.item(0).allPageItems);
g.exportFile(ExportFormat.PNG_FORMAT, File(app.scriptArgs.getValue("pngThumbnailPath")), PDFExportPreset.acrobatCompatibility);
And the error:
Error Number: 55
Error String: Object does not support the property or method 'PNG_FORMAT'
Source: g.exportFile(ExportFormat.PNG_FORMAT, File(app.scriptArgs.getValue("pngThumbnailPath")), PDFExportPreset.acrobatCompatibility);
That's what you get for not mentioning your InDesign version ... PNG_FORMAT has been added in CS4.
Oh, and thanks by the way for reminding me of that site.
On official Adobe webpage...
Don't make me laugh. "That's funny -- it looks suspicously much like the HTML I bloody generated a while ago from the provided Help files" is what I said when I first saw it.
Thank you for the information!
Hey Jongware, do you know if there was any changes in the export format for PNG in the CS5?
Im trying to make a "export selection to png" script, but I dont know why the quality of the PNG generated in CS4 is so poor...