exportDocument(documentURL, annotationURL, callback, tiffOutput)

Use this method to generate a PDF or TIFF document from the current document.

documentURL is a full URL string to the document and can be null if you are exporting the current document that is opened in the viewer.

annotationUrl is a full URL string to the annotations and is required when tiffOutput is true.

When tiffOutput is false or omitted (PDF export), the behavior is as follows: If documentURL is null (exporting the current document opened in the viewer), annotationUrl is ignored and the document along with any annotations displayed in the viewer are exported. If documentURL is provided (exporting a different document), annotationUrl is required if annotations exist for that document and should be included in the export, or can be null if no annotations exist or should not be included. If tiffOutput is true and both documentURL and annotationUrl are null, the current document opened in the viewer and the annotations added to it will be exported as TIFF.

callback is an object that must have three methods, which can be called by the export process:
  • onSuccess(downloadLocation): The export process calls this method when the export is successful and passes the download URL string to the exported document.
  • onError(errorMsg): The export process calls this method if the export finished with an error and passes the error message.
  • onStatusUpdate(message, error, pagesProcessed): The export process calls this method periodically as it checks for the export status. message is the progress status or is empty, error is a Boolean that indicates whether there was an error, pagesProcessed is the number of pages that are exported.

tiffOutput is an optional Boolean parameter that specifies the output format. If true, the document is exported as a TIFF file and annotationUrl is required. If false or omitted, the document is exported as a PDF file (default behavior).

Syntax

exportDocument(documentURL, annotationURL, callback, tiffOutput)

Sample syntax

The following creates a PDF of the current document.

exportDocument("http://myserver.com,/p1.tif", "http://myserver.com,/p1.tif", callback, false);

The following creates a TIFF of the current document.

 exportDocument("http://myserver.com/p1.tif", "http://myserver.com/p1.ant", callback, true);