Create tagged PDF file
As MadeToTag Automate has no UI, it adds objects and methods to the InDesign Server Scripting API. A sample script for exporting is attached to this article.
Sending a script to and running it in InDesign Server
The method for sending the sample scripts to MadeToTag Automate have been described in the Registration and Activation Section Sending a script to and running it in InDesign Server.
Exporting an InDesign Document
To export an InDesign document, you need to run the exportDocument method.
app.theMadeToTagObject.exportDocument( targetDocumentObject , "</path/to/export.pdf>", "<PresetArguments>");
first parameter: targetDocumentObject
As first parameter, you need to pass an InDesign document object, e.g. app.documents.firstItem();
There is no "activeDocument" in InDesign Server. You need to open the document and keep the document reference by yourself, or access the document by methods like app.documents.firstItem()
second parameter: path to export file
As second parameter, you need to pass a path to where the document should be exported to.
When using the InDesign File class, be sure to use fsName (file system name) to ensure proper encoding.
third parameter: preset arguments (optional)
As third parameter, you can pass a Json-String with export parameters. They reflect the settings and options you can define in MadeToTag Desktop Task 7: Create tagged PDF file. If you don't provide the third argument or provide an empty {} json string, MadeToTag Automate will use the default values. Possible values and their defaults are shown in the MadeToTagExport.jsx above.
Exporting an InDesign Book
To export an InDesign document, you need to run the exportBook method.
app.theMadeToTagObject.exportBook( targetBookObject , "</path/to/export.pdf>", "<PresetArguments>");
first parameter: targetBookObject
As first parameter, you need to pass an InDesign book object, e.g. app.books.firstItem();.
second and third parameter
For a description of the second and third argument, see the Exporting an InDesign Document section above.
Return codes
The MadeToTag Automate Scripting object (app.theMadeToTagObject) has a couple of predefined return codes.
| Return code | Return code name | Description |
|---|---|---|
| 0 | ok | successful operation |
| 1 | err_Failure | |
| 2 | err_Cancel | |
| 3 | err_NotImplemented | method is not yet implemented |
| 10 | err_DocNotFound | |
| 11 | err_CannotOpenDocument | |
| 100 | err_InvalidExportKey | |
| 1000 | err_InvalidMethodArg | |
| 1001 | err_InvalidArgCount | |
| 1002 | err_InvalidArgType | |
| 1003 | err_InvalidArgValue | |
| 1004 | err_InvalidMethodTarget | |
| 1005 | err_ArgIsNotDefined | |
| 1006 | err_ArgParseError | |
| 1007 | err_FailedToLoadLibrary | loadLibs: cannot load the additional libraries |
| 1008 | err_InvalidLicense | current license does not cover running this method |
| 1009 | err_InvalidEnterpriseLicense | overwrite key was provided, but is not valid |
| 1010 | err_DateOutOfRange | overwrite key was provided, but is not valid anymore |
| 1011 | err_UnknownMethod | this method is unknown |
0 Comments
Add your comment