download (GET)
{server}/api/v1/printPdf/download/{jobToken}
Description
(requires v2.8 or later)
Use this request to download the output PDF document from a preceding /PrintPdf/print POST request, as identified by the job token returned as data.jobIdentifier.
When a call to /PrintPdf/print returns a status value of 2 (QueuedToFile) use /PrintPdf/status to poll ScriptX.Services. Subsequently when a call to /PrintPdf/status returns 6 (completed) use /PrintPdf/download to download the finished PDF.
See also the OpenAPI (Swagger) definition.
Applies to:
- ScriptX.Services for Cloud
- ScriptX.Services for On-Premise Devices (Authorisation header is ignored)*
- ScriptX.Services for Windows PC*
* Applies only when printing to a default or specified PDF printer driver
Request parameters
jobToken (string, required)
- jobToken (string, required)
- The job identifier for the job to be downloaded, as returned by a preceding POST to /PrintPdf/print.
Example usage
...
...
// previous code to submit print job omitted
// supplies job identifier as 8c72a9871ba64c4ba507b4392c1ce0b9
...
...
jQuery.ajax("https://scriptxservices.meadroid.com/api/v1/printPdf/status/8c72a9871ba64c4ba507b4392c1ce0b9",
{
method: "GET",
dataType: "json",
jsonp: false,
cache: false,
headers: {
"Authorization": "Basic " + btoa("13598d2f-8724-467b-ae64-6e53e9e9f644" + ":")
}
})
.done(function (data, textStatus, jqXHR) {
if (data.status === 6)
{
window.open("https://scriptxservices.meadroid.com/api/v1/printPdf/download/" + data.jobIdentifier, "_self");
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
// handle failure
});