print (POST)

{server}/api/v1/printHtml/print

Description

Print HTML content with given html and device settings.

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

Request parameters

PrintHtmlDescription:
contentType (integer, required)
Defines for the print server the type of content to be printed.
1 (Url - the content parameter will contain the URL of a document to be printed)
2 (Html - the content parameter will contain a complete HTML document wrappend in <html></html> tags)
4 (InnerHtml - - the content parameter will contain an HTML fragment NOT wrapped in <html></html> tags)
content (string, required)
The content to be printed, corresponding to contentType value above. Either a URL or a string of HTML.
description (string, optional)
Optional string that can be used for tracking jobs.
settings (HtmlPrintSettings, optional)
Settings for print job content as described in the HtmlPrintSettings class.
device (DeviceSettings, optional)
Settings for printer/device as described in the DeviceSettings class.
HtmlPrintSettings:
locale (string, optional)
ISO 639-1 language code (eg. "en" for English, "es" for Spanish), used to determine locale-dependent date and time display formats.
shortDateFormat (string, optional)
Short date format string. Default is d (locale-dependent).
longDateFormat (string, optional)
Long date format string. Default is D (locale-dependent).
timeformat (string, optional)
Short time format string. Default is t (locale-dependent).
timezoneOffset (integer, optional)
Client timezone offset (in hours) from UTC.
documentUrl (string, optional)
URL of the HTML document to be printed. Always null when responding to GET settings request.
header (string, optional)
String to print in header of printed output pages. Tokens can be used to represent common information such as date, time, page number etc.
footer (string, optional)
String to print in footer of printed output pages. Tokens can be used to represent common information such as date, time, page number etc.
headerFooterFont (string, optional)
Font that will be used for headers and footers of printed output pages. If value is an empty string the system default font will be used.
page (PageSettings, optional)
Additional page settings as defined by the PageSettings class.
viewScale (integer, optional)
The scaling factor expressed as a percentage that will used to print the document. Value can be -1 ('shrink-to-fit'), 0 ('Default') or any value between 30 and 999.
printBackgroundColorsAndImages (integer, optional)
Option that determines whether background colors and images will be included in the printed output. Value can be 0 (Default), 1 (True) or 2 (False).
pageRange (string, optional)
String that determines which pages of the printed output to print eg. "1,3,5-8" will print pages 1, 3, 5, 6, 7 and 8.
printingPass (integer, optional)
Option to print select pages from printed output. Value can be 0 (Default), 1 (All), 2 (Odd) or 3 (Even).
extraHeadersAndFooters (ExtraHeaderAndFooterSettings, optional)
Extended settings for headers and footers as defined by the ExtraHeaderAndFooterSettings class.
jobTitle (string, optional)
String that identifies the print job.
DevicePrintSettings:
printerName (string, optional)
Name of the printer/device on the server to be used for the print job.
paperSizeName (string, optional)
Name of paper size to use for the print job.
paperSourceName (string, optional)
Name of paper source (or bin) to use for the print job (eg. 'Upper tray').
collate (integer, optional)
Collation for the print job. Value can be 0 (Default), 1 (True) or 2 (False).
copies (integer, optional)
Number of copies to be printed.
duplex (integer, optional)
Type of duplex to be used for the print job. Value can be 0 (Default), 1 (Simplex ie. not Duplex), 2 (Vertical duplex) or 3 (Horizontal duplex).
PageSettings:
orientation (integer, optional)
Setting for page orientation. Value can be 0 (Default), 1 (Landscape) or 2 (Portrait).
units (integer, optional)
Option that specifies the measurement units to be used for margin settings, header and footer heights etc. Value can be 0 (Default), 1 (inches) or 2 (mm).
margins (Margins, optional)
Option that specifies the page margins to be used for printed output as defined by the Margins class. Units are specified by the units setting (see above).
ExtraHeaderAndFooterSettings:
allPagesHeader (string, optional)
String or HTML snippet to print in header of all printed output pages. Tokens can be used to represent common information such as date, time, page number etc.
allPagesFooter (string, optional)
String or HTML snippet to print in footer of all printed output pages. Tokens can be used to represent common information such as date, time, page number etc.
firstPageHeader (string, optional)
String or HTML snippet to print in header of first printed output page in place of allPagesHeader. Tokens can be used to represent common information such as date, time, page number etc.
firstPageFooter (string, optional)
String or HTML snippet to print in footer of first printed output page in place of allPagesFooter. Tokens can be used to represent common information such as date, time, page number etc.
extraFirstPageFooter (string, optional)
String or HTML snippet to print as extra footer of first printed output page in addition to allPagesFooter or firstPageFooter. Tokens can be used to represent common information such as date, time, page number etc.
allHeaderHeight (integer, optional)
Height of headers for all pages, using units as specified in the units setting (see above).
allFooterHeight (integer, optional)
Height of footers for all pages, using units as specified in the units setting (see above).
firstHeaderHeight (integer, optional)
Height of header for first page where firstPageHeader has been specified, using units as specified in the units setting (see above).
firstFooterHeight (integer, optional)
Height of footer for first page where firstPageFooter has been specified, using units as specified in the units setting (see above).
extraFirstFooterHeight (integer, optional)
Height of extra footer for first page where extraFirstPageFooter has been specified, using units as specified in the units setting (see above).
Margins:
left (string, optional)
Left page margin.
top (string, optional)
Top page margin.
bottom (string, optional)
Bottom page margin.
right (string, optional)
Right page margin.

Response model

Print:
status (integer, optional)
Code indicating initial status of submitted job. 1 (Queued to device), 2 (Queued to file), 3 (Soft error), 4 (Ok)
jobIdentifier (string, optional)
Returns the job token which can then be used in status calls to monitor job progress and (if printing to a PDF file) download to download the output file.
message
Returns the name of the output file (if printing to file) in the print server file system.

Example usage