There is very poor documentation on Extendscript for InDesign online, and I otherwise cannot find any detailed / useful information on the exportFile
method... this is all I could find, which is fairly well garbled: .html.
A mon such statement I have seen using
exportFile
would be:
imgs[i].exportFile(ExportFormat.JPG, img, false)
.
This statement uses the
JPG
property of ExportFormat
, is passing a file object img
, and is passing the parameter false
.
I know that the file object has to be instantiated in such a way:
var img = new File(folder + "/" + fileName)
.
...but WTF is
false
for?
Also, it seems as if different file-type properties for the
ExportFormat
object are instantiated in different ways... For instance, I have seen a PDF's ExportFormat to be instantiated as ExportFormat.pdfType
. This variation throws me off, and other file-types seem to have unique property names as well.
So, what exactly are the parameters for the
exportFile
method, and what are all of the properties of these parameters?
There is very poor documentation on Extendscript for InDesign online, and I otherwise cannot find any detailed / useful information on the exportFile
method... this is all I could find, which is fairly well garbled: http://jongware.mit.edu/idcs5/pe_ExportFormat.html.
A mon such statement I have seen using
exportFile
would be:
imgs[i].exportFile(ExportFormat.JPG, img, false)
.
This statement uses the
JPG
property of ExportFormat
, is passing a file object img
, and is passing the parameter false
.
I know that the file object has to be instantiated in such a way:
var img = new File(folder + "/" + fileName)
.
...but WTF is
false
for?
Also, it seems as if different file-type properties for the
ExportFormat
object are instantiated in different ways... For instance, I have seen a PDF's ExportFormat to be instantiated as ExportFormat.pdfType
. This variation throws me off, and other file-types seem to have unique property names as well.
So, what exactly are the parameters for the
exportFile
method, and what are all of the properties of these parameters?
Share
Improve this question
edited Jan 19, 2018 at 21:08
Mogsdad
45.8k21 gold badges163 silver badges285 bronze badges
asked Jun 27, 2012 at 21:07
Ian CampbellIan Campbell
2,74810 gold badges60 silver badges106 bronze badges
3 Answers
Reset to default 3I think resources are quite numerous if you where to find them ;) I really advise you having this bookmark as a favourite : http://jongware.mit.edu/idcs5js_html_3.0.3i/idcs5js/
Once that done, navigate to the pageItem ( Layout ) link and see for exportFile method :
void exportFile (format: varies, to: File[, showingOptions: bool=false][, using: PDFExportPreset][, versionComments: string][, forceSave: bool=false]) Exports the object(s) to a file.
the false means you do not want to use a PDF Export Preset.
Loic
//PDF export preset)
//The default PDF export preset names are surrounded by square breackets
//(e.g., "[High Quality Print], [Press Quality], or [Smallest File Size]").
var myPDFExportPreset = app.pdfExportPresets.item("[Press Quality]");
myDocument.exportFile(
ExportFormat.pdfType,
File(Folder.desktop + "/ExportPDFWithPreset.pdf"),
false,
myPDFExportPreset
);
Yes, no doubt jongware has done a lot for the InDesign scripting munity, as well as http://indesignsecrets./...
I do think that Adobe should provide more thorough documentation themselves though, if they want to reach a wider audience (click here to see the Adobe documentation).
I think this guy Andy Matthews put it well when he said:
"It's worth noting that the documentation for ExtendScript isn't the greatest. If you're used to the docs for Actionscript or ColdFusion, then not only will you be disappointed, but you're going to be confused as well...
...I do wish that Adobe would put a litle more effort into making their tooling and documentation top notch. It would definitely make a difference, and would greatly reduce frustration and could encourage more designers/developers to talk about this software."
(click here to see this page)
As far as books go:
In seeking good resources on Extendscript in InDesign, I have found that the book Scripting InDesign CS3/4 with JavaScript was a really good introduction to Extendscript in InDesign, but it gives only very basic examples...
However, soon I will have the book InDesign CS5 Automation Using XML & JavaScript by Grant Gamble, which seems like a much more prehensive guide. This book apparently includes the entirety of his other book InDesign CS5 JavaScript plus the information about XML.