On this page & docs navigation
On this page
Parameter tableThe single target fieldDefaults at a glanceCommon combinationsWithout cmd: autoInline content and filenameNetwork file type detectionWhere parameters applyPreparing printer driversFAQNext stepsGetting started
OverviewQuickstartMulti-language integrationVersions & capabilitiesAPI reference
Delivery channelsREST endpointsCommands & parametersPrint parameters & defaultsCommand referenceVersion & download APIMulti-language SDKWebSocket /wsAO remote channelAgent integrationScenarios & practice
ExamplesBest practicesFeature demosRelated pages
Solutionscloud servicePricingOpen source & licenceBack
← Back to homepage Download the client →Parameter table
The table below covers the print parameters shared by the client's PrintFile / PrintPdf / QueuePrint and auto detection. Every optional parameter has a clear default — omit it and the default applies; the same settings also work for PrintToPdf / PrintToXps output.
| Parameter | Type | Default | Description | Main scope |
|---|---|---|---|---|
| target | string | One required | The single target field: a local path or http(s) address. Every print command accepts it, so one field is all it takes to send a job | All commands |
| path / label / url / file | string | — | Legacy compatibility aliases; the first non-empty value is taken in the order target → path → label → url → file. New integrations should use target only | All commands |
| content | string | — | Inline print content (plain text or HTML), printed after the text or file-byte signature is identified | auto |
| base64 | string | — | Inline base64 content; data URIs are also supported (e.g. data:application/pdf;base64,JVBERi0xLjQK) | auto |
| filename | string | — | The file name for inline content; it must carry a recognisable extension, and is required when the type cannot be identified from base64 content — a missing name returns a 400 error directly | auto |
| printer | string | Config default → system default | The target printer name; when omitted, the client's configured default printer is used, falling back to the system default | All |
| copies | int | 1 | Number of copies; minimum 1, printer-side maximum 999 | All |
| scale / orientation | string | portrait | portrait / landscape; the two field names are equivalent | All |
| fit | string | fit | fit / shrink (shrink only) / noscale (no scaling) / stretch; compat is a legacy alias | All |
| paperKind | string | Empty (printer default) | A0–A5, LETTER, LEGAL, TABLOID, STATEMENT, or a custom millimetre size (e.g. 100x150) | All |
| printPages / pages | string | 1- | Page range, e.g. 1-3, 2-, 5; all pages by default | PDF, web page to PDF |
| duplex | string | simplex | simplex / duplexlong (aliases long, vertical) for long-edge binding / duplexshort (aliases short, horizontal) for short-edge binding | All |
| color | bool or string | Follow the printer | true / color for colour; false / monochrome for black and white; auto or omitted means the printer setting is not overridden | All |
| collate | bool | true | Collated output for multiple copies (1,2,3,1,2,3); false gives 1,1,2,2,3,3 | All |
| margin | int | 50 | Margins on all four sides, in 1/100 inch (50 = 0.5 inch), range 0–500 | Image / text / SVG / barcode, XPS output |
| bin | string | Empty (automatic) | The name or number of the paper tray to use | PDF, web page to PDF |
| dpi | int | 0 (unspecified) | Assumed document resolution; only affects image print size in noscale mode | PDF, web page to PDF |
| pageOrder / parity | string | Empty (all) | even prints even pages only / odd prints odd pages only | PDF, web page to PDF |
Parameter names keep their exact spelling from the client source; orientation is an alias of scale , parity is an alias of pageOrder , so you can write whichever you are used to.
Version baseline: this page describes the current implementation in the client source; a released installer may not yet include the parameters above. Before integrating, use GET /health and GET /api/commands to check your machine's version, then compare item by item against Versions & capabilities table.
The single target field
Both local paths and network addresses go in target . It is not auto -only: PrintFile, PrintPdf, PrintToPdf, PrintToXps, QueuePrint and auto detection all accept it.
| Form | Applies to | Description |
|---|---|---|
target | Recommended · all commands | A local absolute path, UNC path or http(s) address; one field is all it takes to send a job |
path / label / url / file | Legacy compatibility | Still honoured by every command; values are taken in priority order target → path → label → url → file |
When several fields appear at once, target takes precedence, avoiding the ambiguity of older systems mixing fields. New integrations only need target — no need to distinguish between a local file and a download link.
POST /api/command
{
"target": "https://files.example.com/orders/waybill?id=8891",
"printer": "HP LaserJet Pro M404",
"copies": 2
}
// For a local file, only the value of target changes — the field name stays the same
{
"cmd": "PrintFile",
"target": "D:/labels/waybill.png",
"paperKind": "100x150"
} Defaults at a glance
When you supply only a file address, it is equivalent to the configuration below.
// With no optional parameters, this is the effective configuration (real defaults)
{
"printer": "", // empty = config default → system default
"copies": 1,
"scale": "portrait", // also written as orientation
"fit": "fit",
"paperKind": "", // empty = printer default paper
"printPages": "1-", // all pages
"duplex": "simplex", // single-sided
"color": null, // follow the printer
"collate": true, // collated
"margin": 50, // 0.5 inch
"bin": "",
"dpi": 0,
"pageOrder": ""
} color is three-state: when omitted or auto , it is not sent to the printer, which decides colour or black and white itself; only an explicit true/false (or color/monochrome) overrides it.
Common combinations
Turn common print requirements straight into a request body — any delivery channel will do.
A4 landscape · long-edge duplex · 3 copies · black and white
POST /api/command
{
"cmd": "PrintFile",
"target": "https://files.example.com/reports/monthly.pdf",
"printer": "HP LaserJet Pro M404",
"orientation": "landscape",
"copies": 3,
"duplex": "duplexlong",
"color": "monochrome",
"collate": true,
"paperKind": "A4"
} 100×150 label · no scaling · zero margins
POST /api/command
{
"cmd": "PrintFile",
"target": "D:/labels/waybill.png",
"printer": "POSTEK 2108",
"paperKind": "100x150",
"fit": "noscale",
"margin": 0,
"copies": 1
} Specific tray · odd pages only · short-edge duplex
POST /api/print
{
"target": "https://files.example.com/contract.pdf",
"printer": "HP LaserJet Pro M404",
"bin": "Tray 2",
"pageOrder": "odd",
"duplex": "duplexshort",
"printPages": "1-"
} Without cmd: auto detection
/api/command with cmd omitted, the client follows auto ; you can also write explicitly "cmd":"Auto" or "cmd":"AutoPrint". It only identifies the content source and file form, then hands off to an existing real print command — it never guesses at specialised commands like barcode or ESC/POS printing.
| Present in the request | Auto selection | Basis |
|---|---|---|
| Contains html / templateUrl | Recognised as template printing; routed to TemplatePrint | The template fields are explicit, so there is no ambiguity |
| Contains content / base64 | Written to a temporary file, then printed by file category | The filename extension and file-byte signature are checked first; if neither identifies it, an error is returned |
| Contains target (or a legacy alias) | Handled by PrintFile according to the file form | The download layer judges by filename extension / file-byte signature / response content type |
| Nothing at all | A clear 400 error is returned | No guessing, no silently printing an empty job |
The data.auto in the response gives resolved (the actual command), category (the detected file category) and detectedBy (how it was detected), making troubleshooting easier.
# Without cmd: the client recognises this as a network PDF file
curl -X POST http://127.0.0.1:19861/api/command \\
-H 'Content-Type: application/json' \\
-d '{
"target": "https://files.example.com/orders/waybill?id=8891",
"printer": "HP LaserJet Pro M404",
"copies": 2,
"duplex": "duplexlong"
}'
# The equivalent explicit form: cmd = "Auto" / "AutoPrint" / "PrintFile" // Without cmd, let the client identify the content and file form
const res = await fetch("http://127.0.0.1:19861/api/command", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
target: "https://files.example.com/orders/waybill?id=8891",
copies: 2,
orientation: "landscape"
})
});
const out = await res.json();
console.log(out.data.auto); // { resolved, category, detectedBy } import requests
r = requests.post("http://127.0.0.1:19861/api/command", json={
"target": "https://files.example.com/orders/waybill?id=8891",
"copies": 2,
"duplex": "duplexlong",
}, timeout=30)
out = r.json()
print(out["data"]["auto"]) # identification result using var http = new HttpClient();
var body = new {
target = "https://files.example.com/orders/waybill?id=8891",
copies = 2,
color = "monochrome"
};
var res = await http.PostAsJsonAsync(
"http://127.0.0.1:19861/api/command", body);
Console.WriteLine(await res.Content.ReadAsStringAsync()); payload := strings.NewReader(`{
"target":"https://files.example.com/orders/waybill?id=8891",
"copies":2,"orientation":"landscape"
}`)
resp, err := http.Post("http://127.0.0.1:19861/api/command",
"application/json", payload)
if err != nil { log.Fatal(err) }
defer resp.Body.Close() All examples use the REST endpoints the client genuinely provides, with no JS wrapper or SDK.
Inline content and filename
When you supply content directly with content / base64 , the type is judged by "filename extension → file-byte signature → the media type in the data URI header", and a separately passed contentType is no longer honoured.
| Case | Result |
|---|---|
| Content carries a recognisable signature (%PDF, PNG/JPEG, HTML, SVG, etc.) | Printed directly as that type; filename |
Plain text content (not base64) | Printed as a .txt file |
base64 content with no recognisable signature, but a filename | Printed as a filename 's extension |
base64 content with no recognisable signature and no filename | A 400 error is returned directly — no guessing, no silently printing |
Supported extensions follow GET /api/status the supportedTypes returned by this call; an unsupported extension is never used to guess the type. Network files are judged the same way, by "filename extension → file-byte signature → response Content-Type"; when none of the three identifies it, a clear error is returned.
// Content with a PDF file header needs no filename
{ "base64": "JVBERi0xLjQK...", "copies": 2 }
// Content like Office files, where the header gives no clue, must supply a filename with an extension
{ "base64": "UEsDBBQAAAAI...", "filename": "contract.docx" }
// Content with no recognisable signature and no filename → a clear 400 error
{ "base64": "AAECAwQFBgc..." } Network files: identify first, then print
File addresses generated by business systems often have no extension; the client judges level by level — response file name, file-byte signature, response content type — then handles the file by category.
- Response file name and URL extension first
- Then the file-header signature
- Response content type as the last resort
Network file type detection
PrintFile When it meets an http(s) address, it first downloads to the client's temporary directory, then judges the file type in this order:
- The response's
Content-Dispositionfile name, or a recognisable extension in the URL path itself - File-byte signatures:
%PDF, PNG, JPEG, GIF, BMP, TIFF, HTML, SVG - The response's
Content-Typeextension it maps to (common mappings below)
Supported Content-Type mappings:
application/pdf → .pdfimage/png, image/jpeg, image/gif, image/bmp, image/tiff → the corresponding imagetext/html, image/svg+xml, text/plain, text/csv → .html / .svg / .txtapplication/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint → .doc / .xls / .pptapplication/vnd.openxmlformats-officedocument.* → .docx / .xlsx / .pptxapplication/vnd.ms-xpsdocument, application/ofd → .xps / .ofd
When none of the three identifies it, a clear error is returned — it is never written as an unknown file and left to the system's luck. Once identified, the file is handled by category: layout documents are output as-is; Office, web pages and vector graphics are first converted to printable documents; images and text are laid out and drawn directly by the client.
Printer selection & failover
printer can be specified or omitted: specify it to use the printer you name; omit it and the client selects automatically from the printer statuses maintained by scheduled LAN scanning — online printers that have the capabilities this job needs (colour, duplex, receipts, etc.) come first. You never need to know each printer's model, protocol or capability details.
| Method | Form | Outcome |
|---|---|---|
| Specified | "printer": "HP LaserJet Pro M404" | Uses the specified printer; if it is offline or its capabilities do not match, another is chosen automatically and the response is marked fallback |
| Automatic | with printer | One is chosen from the online candidates by strategies such as "lowest load first"; the response notes the reason and the number of candidates |
| None work | No online candidates | Falls back to the system default printer and marks the response fallback; if the default is unavailable too, a clear error is returned |
Automatic failover when printing fails
When the preferred printer fails during actual printing and the problem is printer-side — connection refused, timeout, offline, paper jam, out of paper, driver error, printer not installed, print service unavailable, etc. — the client automatically retries with the next printer, with no need to resubmit the job. The result of every attempt is recorded in the response's data.reverseRoute.attempts — how many printers were tried and what happened with each, fully auditable.
Rendering failures (unhandled file type), download failures (network file unreachable), unrecognisable content and missing local files cannot be fixed by switching printers, so the client returns the error directly instead of retrying pointlessly. To turn off failover and stick with the preferred printer only, set PrintFailoverEnabled to false; PrintFailoverMaxAttempts controls the maximum number of printers to try (including the preferred one).
{
"target": "https://files.example.com/orders/waybill?id=8891",
"copies": 2,
"duplex": "duplexlong"
}
// 返回片段(首选失败、自动换机成功):
// "data": {
// "reverseRoute": {
// "selected": "Brother DCP-T420W",
// "reason": "自动选中「Brother DCP-T420W」……",
// "attempts": [
// { "printer": "HP LaserJet Pro M404", "ok": false, "message": "连接被拒绝" },
// { "printer": "Brother DCP-T420W", "ok": true, "message": "print successful!" }
// ],
// "failover": true
// }
// } Where parameters apply
Different file categories support different parameter ranges. The table below lists the handling and prerequisites per the real implementation, without promising anything about internals.
| File form | Handling & prerequisites | Parameters that apply |
|---|---|---|
| Output according to the document's own layout | Page range, scaling, orientation, copies, paper, duplex, colour, collation, tray, DPI, odd/even pages | |
| Image / text / SVG / barcode | Laid out and drawn directly by the client | Copies, orientation, scaling, paper, duplex, colour, collation, margins |
| HTML / MHTML | Converted to a printable document first, then output | Same as PDF; background graphics are controlled by the CSS print-color-adjust property; requires web rendering capability on this machine |
| Office documents | Converted to a printable document first, then output | Same as PDF; requires document conversion capability on this machine, otherwise parameters are not guaranteed to apply |
| XPS | Reconstructed from the page content, then output | Same as images |
| OFD | Converted to a printable document first, then output | Same as PDF; requires the corresponding conversion capability on this machine |
| Extensions this machine does not support | Handed to the system's associated program | Determined by the associated program; client parameters do not apply |
PDF-side parameters are mapped to the document's print capabilities; duplex, colour, collation and the like ultimately depend on whether the printer and driver have the corresponding capabilities.
Preparing printer drivers
The desktop client is 64-bit Windows. Printer drivers are installed by an administrator through the printer vendor's official channels; the client never downloads or installs any driver automatically.
Install through official channels first
Drivers are tied to the printer model and system version; an administrator should obtain and install them from the vendor's official channels.
Then self-check the status
CheckPrinterDriver read-only returns the printer list, driver names, ports and needsDriver (with IsValid as the source of truth).
Capabilities follow the driver
Whether duplex, colour, collation, tray and similar parameters ultimately apply depends on whether the printer and driver have the corresponding capabilities.
GET /api/commands # 确认该版本是否含 CheckPrinterDriver
GET /api/printers # 便捷端点,列出本机打印机
POST /api/command # { "cmd": "CheckPrinterDriver" } → 只读诊断结果 The PDF component built into the client is a bundled program resource, a different thing from printer drivers; its online recovery is fetched only from official channels, with source, size and digital signature verified — if verification fails, it is not enabled.
FAQ
Is a single target enough?
Yes. Both local paths and http(s) addresses go in target, and PrintFile, PrintPdf, PrintToPdf, PrintToXps, QueuePrint and auto all accept it; path / label / url / file are legacy compatibility aliases and still work.
Can it really print without cmd?
Yes. When /api/command omits cmd it follows auto; you can also write \"cmd\":\"Auto\" or \"cmd\":\"AutoPrint\" explicitly. The returned data.auto tells you which command was actually used, what type was detected, and on what basis.
Could auto mistake plain text for receipt commands?
No. Auto detection only handles files, URLs and inline content; it never guesses at specialised commands like PrintBarcode or PrintEscPos — specify cmd explicitly when you need those.
What if the printer breaks mid-job?
When the preferred printer hits a printer-side problem — connection refused, timeout, offline, paper jam, out of paper, driver error, etc. — the client automatically retries with the next printer in the candidate order, and the returned data.reverseRoute.attempts records each printer's result. Rendering failures, download failures and unrecognisable content are reported directly, since switching printers would not help. Set PrintFailoverEnabled to false in the configuration to turn off automatic failover.
Is filename always required with base64?
Not when the content carries a recognisable file signature (such as the %PDF or PNG/JPEG header, or HTML/SVG markup), or when a data URI with a media type is used. Otherwise a filename with an extension (e.g. label.pdf) is required. If nothing can be identified and no filename is given, a 400 error is returned directly — no guessing.
Is the contentType field still useful?
The client no longer honours a separately passed contentType for judging inline content type; it judges only by filename extension and file-byte signature, avoiding misprints when the declaration and the content disagree. The media type in a data URI header is still used; network files are judged by the three levels of filename extension / file-byte signature / response Content-Type.
Why did my margin have no effect on the PDF?
A PDF's page size is decided by the file itself and fit; margin mainly applies to the types the client lays out and draws directly (image, text, SVG, barcode) and to XPS output. Compare against the "Where parameters apply" table.
Is duplex guaranteed to work?
The parameter is sent to both the document output and the system print settings, but whether duplex ultimately works depends on whether the printer and driver support it.
How do I control background images, watermarks and digital stamps?
They are content, not print parameters: put them in the file itself or the HTML template. When converting HTML to PDF, use the CSS print-color-adjust: exact property to output background graphics; the client has no separate printBackground switch.
What about network links that need authentication?
Generate an address the client can download directly on the business-system side before submitting. The client downloads with a standard HTTP GET and does not currently forward custom request headers.
How should I prepare printer drivers?
The desktop client is 64-bit Windows; drivers are installed by an administrator through the printer vendor's official channels, and the client never downloads or installs any driver automatically. Use the CheckPrinterDriver command to read-only inspect this machine's printers, driver names and availability.
What does data.engine return?
It returns a file category identifier (such as pdf / image / office / html / xps / ofd / text), confirming which category the file was actually handled as; it does not indicate which internal component was used.