download (GET)
{server}/api/v1/printHtml/download/{jobToken}
Description
Use this request to download the output PDF document from a preceding /PrintHtml/print POST request, as identified by the job token returned as data.jobIdentifier.
When a call to /PrintHtml/print returns a status value of 2 (QueuedToFile) use /PrintHtml/status to poll ScriptX.Services. Subsequently when a call to /PrintHtml/status returns 6 (completed) use /PrintHtml/download to download the completed 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 /PrintHtml/print.
Example usage
    ...
    ...
    // previous code to submit print job omitted
    // supplies job token/identifier as 8c72a9871ba64c4ba507b4392c1ce0b9
    ...
    ...
    const jobToken = "8c72a9871ba64c4ba507b4392c1ce0b9";
    const servicesServerURL = "https://scriptxservices.meadroid.com";
    const authorizationToken = btoa("13598d2f-8724-467b-ae64-6e53e9e9f644" + ":");
    fetch(`${servicesServerURL}/api/v1/printHtml/status/${jobToken}`, {
        method: "GET",
        headers: {
            "Authorization": `Basic ${authorizationToken}`
        }
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.json();
    })
    .then(data => {
        if (data.status === 6) {
            window.open(`${servicesServerURL}/api/v1/printHtml/download/${data.jobIdentifier}`, "_self");
        }
    })
    .catch(error => {
        console.error('There has been a problem with your fetch operation:', error);
    });