HTML to PDF Command Line Reference

Use this command line reference for option names, accepted values, defaults, and PDF output.

Conversion from HTML to PDF.

html2pdf [options] SOURCE
pdfcrowd html2pdf [options] SOURCE
html2pdf auth ACTION
html2pdf help [TOPIC|OPTION|CATEGORY]

Commands and Options

Conversion Input

SOURCE

Supply exactly one input source:

  • URL: an HTTP(S) URL.
  • File: the path to an existing local input file.
  • Standard input: - reads input bytes from a pipe or redirection.
  • HTML string: pipe HTML content to -; a literal HTML string is not a positional source argument.

Options may appear before or between sources. Use -- before a file name that starts with a dash.

Examples:
  • URL: html2pdf --output result.pdf https://example.com
  • Local file: html2pdf --output result.pdf input.html
  • Standard input: html2pdf --output result.pdf - < input.html
  • HTML string: printf '%s' '<h1>Hello</h1>' | html2pdf --output result.pdf -

--zip-main-filename

Set the file name of the main HTML document stored in the input archive. Use this when your ZIP/TAR archive contains multiple HTML files and you need to specify which one to convert.

If not specified, the first HTML file found in the archive is automatically used for conversion.

Syntax:
--zip-main-filename FILENAME

Output

Results go to standard output by default. Binary output requires a file, pipe, or redirection; only pdf2text writes directly to a terminal. Some converters produce ZIP archives containing their results. Diagnostics use standard error.

--output, -o FILE

Save the result to FILE. Use - for standard output.

An existing output file is replaced only after a successful conversion.

To send binary results to standard output, redirect them to a file or pipe them to another program.

Default:
standard output
Example:
  • html2pdf --output FILE SOURCE

Configuration

If the default configuration file exists, conversions read it automatically. Conversions never save settings automatically. Run html2pdf help configuration to see the default file path. --config and --no-config are mutually exclusive.

Use a UTF-8 INI file with option-name = value lines and no [section] headings. Use the option names with hyphens and without leading dashes, for example debug-log instead of --debug-log. Lines starting with # or ; are comments.

For large HTML, CSS, or JavaScript values, keep the content in a separate UTF-8 file and use @{PATH} as the setting's value. The CLI reads the file's content without changing its whitespace or line breaks. Relative paths in an INI file are resolved from the config file's directory. On the command line, they are resolved from the current working directory. Do not put quotes around @{PATH} in the INI file; quote it when passing it on the command line.

For a large HTML header, save your HTML as header.html. Save these settings as defaults.ini in the same directory:

page-size = A4
header-html = @{header.html}

Convert using that configuration:

html2pdf --config defaults.ini --output result.pdf https://example.com

You can also use the HTML file directly on the command line:

html2pdf --header-html "@{header.html}" --output result.pdf https://example.com

Inline values can span multiple lines when each continuation line is indented more than the setting name. A blank line ends the value. Use a separate file for content that needs blank lines or exact formatting.

--config PATH

Read conversion defaults from PATH instead of the default file.

Command-line options override the settings in this file. This option applies to conversion settings; credentials are stored separately.

Examples:
  • html2pdf --config PATH --output FILE SOURCE
  • html2pdf --config ./defaults.ini -o result SOURCE

--no-config

Ignore saved conversion defaults for this command.

Command-line conversion options still apply. Saved credentials and environment variables still apply. The config file is left unchanged.

Example:
  • html2pdf --no-config --output FILE SOURCE

--init-config

Create a commented config file that you can edit.

Open the created file and remove the leading # from settings you want to use. Future conversions read the default file automatically.

Use --config PATH to create a file at another location. An existing file is left unchanged. This command does not perform a conversion.

Examples:
  • html2pdf --init-config [--config PATH]
  • html2pdf --init-config
  • html2pdf --init-config --config ./defaults.ini

--show-config

Show saved defaults and command-line overrides without converting.

Each setting shows whether it came from the config file or the command line. Other options use their API defaults.

Sensitive values and inline HTML, CSS, and JavaScript are hidden. No files are changed.

Examples:
  • html2pdf --show-config [options]
  • html2pdf --show-config
  • html2pdf --no-config --show-config

Authentication

For account setup and credential selection, see Authentication.

auth ACTION

Manage credentials shared by all converter commands.

ACTION: Choose login, status, or logout.

Usage:
html2pdf auth ACTION
pdfcrowd auth ACTION

auth login [--non-interactive]

Save your PDFCrowd username and API key for all converter commands.

Use both credential environment variables when set; otherwise prompt in an interactive terminal. The API-key prompt hides your input.

In a script, use --non-interactive to require environment credentials without prompting. This saves the account; it does not perform a conversion.

Usage:
html2pdf auth login [--non-interactive]
pdfcrowd auth login [--non-interactive]
auth login --non-interactive

This option applies only to auth login.

Require environment credentials when saving an account with auth login; never prompt.

Set both PDFCROWD_USERNAME and PDFCROWD_API_KEY before running this command. The account is saved for all converters. Missing credentials cause an error.

Example:
  • html2pdf auth login --non-interactive

auth status

Show which credentials will be used without revealing the API key.

This reads local settings; it does not verify the account with PDFCrowd.

Usage:
html2pdf auth status
pdfcrowd auth status

auth logout

Remove the saved account for all converter commands.

Credential environment variables still apply when set.

Usage:
html2pdf auth logout
pdfcrowd auth logout

Help and Version

help [TOPIC|OPTION|CATEGORY]

Show offline help for this converter.

Help does not load saved settings or credentials and does not contact the service.

TOPIC|OPTION|CATEGORY: Omit the argument for an overview. Supply one topic, option name (with or without --), or conversion category ID.

  • all: List every option.
  • categories: List help topics and conversion option groups.
  • syntax: Explain how to supply arguments.
  • configuration: Save and load conversion defaults.
  • authentication: Set up your PDFCrowd account.
  • input-output: Read inputs and save results.
  • exit-codes: Check whether a command succeeded.
Usage:
html2pdf help [TOPIC|OPTION|CATEGORY]
pdfcrowd help html2pdf [TOPIC|OPTION|CATEGORY]
Examples:
  • html2pdf help all
  • html2pdf help categories
  • html2pdf help --output
help --json

This option applies only to help.

Print help as JSON for scripts, integrations, and AI agents.

Includes option names, argument types, defaults, allowed values, authentication rules, and exit codes. Works offline.

Example:
  • html2pdf help --json

--help, -h

Show a summary of commands and options.

Use help all for every option, or help OPTION for details.

Example:
  • html2pdf --help

--version, -V

Show the PDFCrowd CLI version.

Example:
  • html2pdf --version

Page Setup

--page-size

Set the output page size using standard formats (A4, Letter, A3, etc.). Use A4 for international documents, Letter for US-based content, or larger sizes like A3 for posters and presentations.

Syntax:
--page-size SIZE
Default:
A4
Allowed Values:
  • A0
  • A1
  • A2
  • A3
  • A4
  • A5
  • A6
  • Letter

--page-width

Set custom page dimensions when standard sizes don't fit your needs. Useful for banners, receipts, custom forms, or when matching specific printing equipment.

The safe maximum is 200in - larger sizes may fail to open in some PDF viewers. For standard sizes like A4 or Letter, use the predefined page size option instead.

Syntax:
--page-width WIDTH
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
8.27in
Examples:
  • A4 landscape / A3 portrait width: "297mm"
  • US Letter/Legal standard width: "8.5in"

--page-height

Set custom page height for specific formats like receipts, banners, or legal documents. Set to "-1" for a single-page PDF that expands to fit all content vertically. Use this for web pages, infographics, or documents where page breaks are undesirable.

The safe maximum is 200in otherwise some viewers cannot open the PDF. For standard sizes, use the predefined page size option instead.

Syntax:
--page-height HEIGHT
Constraint:
  • The value must be -1 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
11.7in
Examples:
  • A3 standard height for large format: "420mm"
  • Auto-fit entire content in single page: "-1"
  • US Legal for contracts and documents: "14in"

--page-dimensions

Set both page width and height simultaneously for custom page sizes. Use this when you need non-standard dimensions like banners, receipts, or custom forms that don't match A4, Letter, or other predefined sizes.

Provide width and height with units (e.g., "210mm", "8.5in"). Maximum safe value is 200in for each dimension - larger sizes may fail to open in some PDF viewers.

Syntax:
--page-dimensions WIDTH HEIGHT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Constraint:
  • The value must be -1 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Examples:
  • A4 portrait dimensions: "210mm", "297mm"
  • US Letter dimensions: "8.5in", "11in"
  • A3 portrait dimensions: "297mm", "420mm"

--orientation

Set the output page orientation to portrait or landscape. Use landscape for wide content like spreadsheets, charts, or dashboards. Use portrait for standard documents and text-heavy content.

Syntax:
--orientation ORIENTATION
Default:
portrait
Allowed Values:
  • landscape
  • portrait

--margin-top

Control white space at the top of the page. Increase for header space, formal documents, or annotation room (e.g., 1in or more). Decrease to maximize content area or fit more content (e.g., 5mm to 10mm).

Default 0.4in balances readability with space efficiency. Set to 0 for full-bleed designs. Affects where content starts and where headers appear.

Syntax:
--margin-top TOP
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
0.4in
Examples:
  • Wide margin for binding: "1in"
  • Narrow margin: "10mm"

--margin-right

Control white space on the right edge of the page. Increase for binding/hole-punch clearance or note-taking space (e.g., 1in or more). Decrease to fit wider content (e.g., 5mm to 10mm).

Default 0.4in balances readability with space efficiency. Set to 0 for full-bleed designs. Affects where content wraps and text line length.

Syntax:
--margin-right RIGHT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
0.4in
Examples:
  • Wide margin for binding: "1in"
  • Narrow margin: "10mm"

--margin-bottom

Control white space at the bottom of the page. Increase for footer space, page numbers, or formal documents (e.g., 1in or more). Decrease to fit more content per page (e.g., 5mm to 10mm).

Default 0.4in balances readability with space efficiency. Set to 0 for full-bleed designs. Affects where content ends and where footers appear.

Syntax:
--margin-bottom BOTTOM
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
0.4in
Examples:
  • Wide margin for binding: "1in"
  • Narrow margin: "10mm"

--margin-left

Control white space on the left edge of the page. Increase for binding/hole-punch clearance or note-taking space (e.g., 1in or more). Decrease to fit wider content (e.g., 5mm to 10mm).

Default 0.4in balances readability with space efficiency. Set to 0 for full-bleed designs. Affects where content starts horizontally and text line length.

Syntax:
--margin-left LEFT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
0.4in
Examples:
  • Wide margin for binding: "1in"
  • Narrow margin: "10mm"

--no-margins

Disable all page margins to use the entire page area. Use this for full-bleed designs where content should extend to the page edges, such as posters, certificates, or branded materials.

Combine with custom CSS to ensure your content fills the page properly.

Syntax:
--no-margins[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--page-margins

Set all four page margins (top, right, bottom, left) simultaneously for consistent spacing. Use this when you need uniform margins for binding, formal documents, or when applying the same spacing to all edges at once.

Provide margin values with units (e.g., "1in", "25mm"). Use larger values (1in+) for binding clearance or annotations, smaller values (5-10mm) to maximize content area. Set to "0" for full-bleed designs.

Syntax:
--page-margins TOP RIGHT BOTTOM LEFT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.

--content-viewport-width

Set the viewport width for formatting the HTML content when generating a PDF. Use this to control how responsive designs render - prevent mobile styles from applying when you want desktop layout, or ensure content appears at the right width.

Specify a viewport width to control content rendering, ensuring it mimics the appearance on various devices or matches specific design requirements.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--content-viewport-width WIDTH
Constraint:
  • The value must be 'balanced', 'small', 'medium', 'large', 'extra-large', or a number in the range 96-65000px.
Default:
medium
Allowed Values:
  • balanced — Adjusts the viewport width to fit the print area.
  • small — Selects a narrower viewport.
  • medium — Selects the default viewport width.
  • large — Selects a wider viewport.
  • extra-large — Selects an extra-wide viewport.
  • pixel width — A precise viewport width in pixels, such as 1024px, to tailor the PDF's text density to your specific requirements. The value must be in the range 96-65000px.
Examples:
  • Use the "large" viewport: "large"
  • Use an 800 pixels wide viewport: "800px"

--content-viewport-height

Set the viewport height for formatting the HTML content when generating a PDF. Specify a viewport height to enforce loading of lazy-loaded images and affect vertical positioning of absolutely positioned elements within the content.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--content-viewport-height HEIGHT
Constraint:
  • The value must be 'auto', 'large', or a number.
Default:
auto
Allowed Values:
  • auto — The height of the print area is used. For most pages, this is sufficient. Use "large" or custom values for pages with extensive lazy-loaded content.
  • large — Value suitable for documents with extensive lazy-loaded content.
  • pixel height — A specific numerical value, such as 10000px, to set as the window height, allowing precise control based on the document's requirements.
Examples:
  • Load all lazy images and content: "large"
  • Force tall viewport for long pages: "5000px"

--content-fit-mode

Specify the mode for fitting the HTML content to the print area by upscaling or downscaling it. Use this to prevent content from being cut off at page edges or to enable smart scaling of oversized content.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--content-fit-mode MODE
Default:
auto
Allowed Values:
  • auto — Automatic mode
  • smart-scaling — Smartscaling to fit more content into the print area.
  • no-scaling — No scaling is performed. Content may be cut off if it exceeds page boundaries.
  • viewport-width — The viewport width fits the print area width.
  • content-width — The HTML content width fits the print area width.
  • single-page — The entire HTML content fits the print area of a single page.
  • single-page-ratio — The entire HTML content fits the print area of a single page, maintaining the aspect ratio of the page height and width.

--remove-blank-pages

Specify which blank pages to exclude from the output document to create cleaner PDFs. Use "trailing" to remove empty pages at the end caused by page break issues. Use "all" to remove blank pages throughout the document when converting content with formatting quirks. Helps eliminate unwanted white pages from the final output.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--remove-blank-pages PAGES
Default:
trailing
Allowed Values:
  • trailing — Trailing blank pages are removed from the document.
  • all — All empty pages are removed from the document.
  • none — No blank page is removed from the document.

Watermark & Background

--page-watermark

Apply the first page of a watermark PDF to every page of the output PDF. Use this to add transparent overlays like "DRAFT" stamps, security markings, or branding elements that appear on top of content. Use this to mark confidential documents.

Syntax:
--page-watermark WATERMARK
Constraint:
  • The file must exist and not be empty.
Examples:
  • Multi-page PDF for watermarking: "/home/user/john/watermark.pdf"
  • Transparent PNG overlay: "/home/user/john/watermark.png"

--page-watermark-url

Load a file from the specified URL and apply the file as a watermark to each page of the output PDF. A watermark can be either a PDF or an image. If a multi-page file (PDF or TIFF) is used, the first page is used as the watermark.

Syntax:
--page-watermark-url URL
Constraint:
  • Supported protocols are http:// and https://.
Examples:
  • Download watermark from server: "http://myserver.com/watermark.pdf"
  • Remote logo watermark: "http://myserver.com/watermark.png"

--multipage-watermark

Apply each page of a watermark PDF to the corresponding page of the output PDF. Use this for page-specific watermarks where different pages need different overlays - for example, different approval stamps per department.

If the watermark has fewer pages than the output, the last watermark page is repeated for remaining pages.

Syntax:
--multipage-watermark WATERMARK
Constraint:
  • The file must exist and not be empty.
Examples:
  • Multi-page PDF for watermarking: "/home/user/john/watermark.pdf"
  • Transparent PNG overlay: "/home/user/john/watermark.png"

--multipage-watermark-url

Load a file from the specified URL and apply each page of the file as a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.

Syntax:
--multipage-watermark-url URL
Constraint:
  • Supported protocols are http:// and https://.
Examples:
  • Download watermark from server: "http://myserver.com/watermark.pdf"
  • Remote logo watermark: "http://myserver.com/watermark.png"

--page-background

Apply the first page of a background PDF to every page of the output PDF. Use this to add letterheads, branded templates, or decorative backgrounds that appear behind your content. Backgrounds appear beneath content, while watermarks layer on top.

Syntax:
--page-background BACKGROUND
Constraint:
  • The file must exist and not be empty.
Examples:
  • PDF template background: "/home/user/john/background.pdf"
  • Image texture background: "/home/user/john/background.png"

--page-background-url

Load a file from the specified URL and apply the file as a background to each page of the output PDF. A background can be either a PDF or an image. If a multi-page file (PDF or TIFF) is used, the first page is used as the background.

Syntax:
--page-background-url URL
Constraint:
  • Supported protocols are http:// and https://.
Examples:
  • Download template background: "http://myserver.com/background.pdf"
  • Remote background pattern: "http://myserver.com/background.png"

--multipage-background

Apply each page of a background PDF to the corresponding page of the output PDF. Use this for page-specific backgrounds where each page needs a different template - for example, different letterheads for front and back pages.

If the background has fewer pages than the output, the last background page is repeated for remaining pages.

Syntax:
--multipage-background BACKGROUND
Constraint:
  • The file must exist and not be empty.
Examples:
  • PDF template background: "/home/user/john/background.pdf"
  • Image texture background: "/home/user/john/background.png"

--multipage-background-url

Load a file from the specified URL and apply each page of the file as a background to the corresponding page of the output PDF. A background can be either a PDF or an image.

Syntax:
--multipage-background-url URL
Constraint:
  • Supported protocols are http:// and https://.
Examples:
  • Download template background: "http://myserver.com/background.pdf"
  • Remote background pattern: "http://myserver.com/background.png"

--page-background-color

Set a solid background color for all pages, filling the entire page area including margins. Useful for creating branded PDFs with corporate colors, highlighting draft documents, or improving readability with off-white backgrounds.

Supports transparency with RGBA format - use semi-transparent colors for subtle effects without obscuring content. Format as RGB (FF0000) or RGBA (FF000080) hexadecimal.

Syntax:
--page-background-color COLOR
Constraint:
  • The value must be in RRGGBB or RRGGBBAA hexadecimal format.
Examples:
  • red color: "FF0000"
  • green color: "00ff00"
  • green color with 50% opacity: "00ff0080"

General Options

--use-print-media

Use the print version of the page if available via @media print CSS rules. Enable this when converting websites that have print-optimized styles. Many sites hide navigation, ads, and sidebars in print mode.

Produces cleaner PDFs by using the design the website creator intended for printing.

Syntax:
--use-print-media[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--no-background

Do not print the background graphics to create printer-friendly PDFs. Use this when documents will be physically printed to save ink costs and improve readability.

Removes background colors, images, and patterns while preserving text and foreground content. Particularly useful for documents with dark backgrounds or decorative elements.

Syntax:
--no-background[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--disable-javascript

Do not execute JavaScript during conversion. Use this to improve conversion speed when JavaScript is not needed, prevent dynamic content changes, or avoid security risks from untrusted scripts.

Note that disabling JavaScript means lazy-loaded images and AJAX content will not load.

Syntax:
--disable-javascript[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--disable-image-loading

Do not load images during conversion to create text-only PDFs. Use this to significantly speed up conversion, reduce file size, or create accessible text-focused documents.

Use this for converting documentation where images are not needed, reducing bandwidth usage, or creating lightweight PDFs for email distribution.

Syntax:
--disable-image-loading[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--disable-remote-fonts

Disable loading fonts from remote sources. Use this to speed up conversion by avoiding font download delays, ensure consistent rendering with system fonts, or work around font loading failures.

Note that text will fall back to system fonts, which may change the document's appearance.

Syntax:
--disable-remote-fonts[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--load-iframes

Specifies how iframes are handled during conversion. Use "all" to include all embedded content (videos, maps, widgets). Use "same-origin" to include only content from the same domain for security purposes. Use "none" to exclude all iframes for faster conversion and to avoid third-party content issues.

Disabling iframes can significantly improve performance and reliability.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--load-iframes IFRAMES
Default:
all
Allowed Values:
  • all — All iframes are loaded.
  • same-origin — Only iframes with the same origin as the main page are loaded.
  • none — Iframe loading is disabled.

--block-ads

Automatically block common advertising networks and tracking scripts during conversion, producing cleaner PDFs with faster conversion times. Filters out third-party ad content, analytics beacons, and ad network resources.

Use this for converting news sites, blogs, or any ad-heavy content where ads distract from the main message. May occasionally block legitimate third-party content - disable if critical third-party resources are missing.

Syntax:
--block-ads[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--default-encoding

Specify the character encoding when the HTML lacks proper charset declaration or has incorrect encoding. Prevents garbled text for non-English content, especially legacy pages without UTF-8 encoding.

Set to "utf-8" for modern content, "iso-8859-1" for Western European legacy pages, or other encodings for specific regional content. Only needed when auto-detection fails and you see corrupted characters in the output.

Syntax:
--default-encoding ENCODING
Default:
auto detect
Examples:
  • Set to use Latin-2 encoding: "iso8859-2"
  • Set to use UTF-8 encoding: "utf-8"

--locale

Set the locale for the conversion to control regional formatting of dates, times, and numbers. Use this when converting content for specific regions - for example, set to "en-US" for MM/DD/YYYY dates and comma thousand separators, or "de-DE" for DD.MM.YYYY dates and period thousand separators.

Essential for financial reports, invoices, or localized content.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--locale LOCALE
Default:
en-US
Example:
  • Set to use Japanese locale: "ja-JP"

--http-auth

Set credentials to access HTTP basic authentication protected websites. Use this when converting content behind HTTP authentication, such as development servers, staging environments, or password-protected documentation.

Provide both username and password to authenticate requests. Essential for converting internal resources or protected content.

Syntax:
--http-auth USER_NAME PASSWORD

--cookies

Set HTTP cookies to be included in all requests made by the converter to access authenticated or session-based content. Use this when converting pages that require login, maintain user sessions, or personalize content based on cookies.

Essential for converting member-only areas, dashboards, or any content behind cookie-based authentication. Format as semicolon-separated name=value pairs.

Syntax:
--cookies COOKIES
Example:
  • Multiple cookies for authentication: "session=6d7184b3bf35;token=2710"

--verify-ssl-certificates

Enforce SSL certificate validation for secure connections, preventing conversions from sites with invalid certificates. Enable when converting from production sites with valid certificates to ensure security.

When disabled, allows conversion from any HTTPS site regardless of certificate validity - including development servers with self-signed certificates, internal corporate sites with expired certificates, or local testing environments.

Syntax:
--verify-ssl-certificates[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--fail-on-main-url-error

Abort the conversion if the HTTP status code of the main URL is greater than or equal to 400 (client/server errors). Use this in automated workflows to catch broken URLs or authentication failures early rather than producing invalid PDFs. Ensures your system does not silently generate error page PDFs when source content is unavailable.

Syntax:
--fail-on-main-url-error[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--fail-on-any-url-error

Abort the conversion if any sub-request (images, stylesheets, scripts) fails with HTTP 400+ errors. Use this for strict quality control when all assets must load successfully.

Syntax:
--fail-on-any-url-error[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--no-xpdfcrowd-header

Do not send the X-Pdfcrowd HTTP header in HTTP requests made by the converter. Use this if your target server blocks or logs requests with this header, or for privacy when you do not want sites to know you are using PDFCrowd. Some security systems may block requests with non-standard headers.

Syntax:
--no-xpdfcrowd-header[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--css-page-rule-mode

Specifies behavior in the presence of CSS @page rules to control which settings take precedence. Use "default" to prioritize API settings over CSS rules, ensuring consistent output regardless of input HTML. Use "mode2" to respect CSS @page rules for print-optimized HTML.

This solves conflicts when CSS tries to override your API page setup.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--css-page-rule-mode MODE
Default:
default
Allowed Values:
  • default — The PDFCrowd API page settings are preferred.
  • mode1 — The converter version 18.10 mode. Use for backward compatibility with legacy conversion behavior.
  • mode2 — CSS @page rule is preferred. Use when your HTML has print-optimized @page rules that should override API settings.

--custom-css

Apply custom CSS to the input HTML document to modify the visual appearance and layout of your content dynamically. Use this to override default styles, adjust spacing, change fonts, or fix layout issues without modifying the source HTML.

Use !important in your CSS rules to prioritize and override conflicting styles.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--custom-css CSS
Text from a file:
Use @{PATH} as the value to read UTF-8 text from a file. Relative paths in a config file are resolved from that file's directory; command-line paths are resolved from the current working directory. See Configuration for details.
Examples:
  • Set the page background color to gray: "body { background-color: gray; }"
  • Do not show nav HTML elements and the element with ad-block ID in the output PDF: "nav, #ad-block { display: none !important; }"

--custom-javascript

Run a custom JavaScript after the document is loaded and ready to print. Use this to modify page content before conversion, remove unwanted elements, or trigger specific page states. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...).

In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.

Syntax:
--custom-javascript JAVASCRIPT
Text from a file:
Use @{PATH} as the value to read UTF-8 text from a file. Relative paths in a config file are resolved from that file's directory; command-line paths are resolved from the current working directory. See Configuration for details.
Example:
  • Set the page background color to gray: "document.body.style.setProperty('background-color', 'gray', 'important')"

--on-load-javascript

Run a custom JavaScript right after the document is loaded. The script is intended for early DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.

Syntax:
--on-load-javascript JAVASCRIPT
Example:
  • Set the page background color to gray: "document.body.style.setProperty('background-color', 'gray', 'important')"

--custom-http-header

Set a custom HTTP header to be included in all requests made by the converter. Use this to pass authentication tokens to protected sites, add tracking headers for analytics, or provide API keys for accessing private content.

Essential when converting content from APIs or internal systems that require special headers for access control.

Syntax:
--custom-http-header HEADER
Constraint:
  • A string containing the header name and value separated by a colon.
Example:
  • API client tracking header: "X-My-Client-ID:k2017-12345"

--javascript-delay

Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. Use this to ensure lazy-loaded images, AJAX content, or animations complete before conversion. Your license defines the maximum wait time by "Max Delay" parameter.

Syntax:
--javascript-delay DELAY
Constraint:
  • Must be a positive integer or 0.
Default:
200
Example:
  • Wait for 2 seconds: 2000

--element-to-convert

Convert only the specified element from the main document and its children. Use this to extract specific portions of a page (like article content) while excluding navigation, headers, footers, or sidebars. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.

Syntax:
--element-to-convert SELECTORS
Examples:
  • The first element with the id main-content is converted: "#main-content"
  • The first element with the class name main-content is converted: ".main-content"
  • The first element with the tag name table is converted: "table"
  • The first element with the tag name table or with the id main-content is converted: "table, #main-content"
  • The first element <p class="article"> within <div class="user-panel main"> is converted: "div.user-panel.main p.article"

--element-to-convert-mode

Control how CSS styles are applied when converting only part of a page. The "cut-out" option extracts the element into a new document root, which may break CSS selectors like "body > div". The "remove-siblings" option keeps the element in its original DOM position but deletes other elements, preserving descendant selectors. The "hide-siblings" option keeps all elements but hides non-selected ones with display:none, preserving all CSS context.

Syntax:
--element-to-convert-mode MODE
Default:
cut-out
Allowed Values:
  • cut-out — The element and its children are cut out of the document.
  • remove-siblings — All element's siblings are removed from the DOM. Keeps target element in position but may break descendant CSS selectors.
  • hide-siblings — All element's siblings are hidden using display:none. Preserves CSS context while hiding non-target content.

--wait-for-element

Wait for the specified element in a source document. Use this when specific dynamic content must be ready before conversion, avoiding unnecessary delays from a fixed JavaScript delay. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes.

If the element is not found, the conversion fails. Your license defines the maximum wait time by the "Max Delay" parameter.

Syntax:
--wait-for-element SELECTORS
Examples:
  • Wait until an element with the id main-content is found: "#main-content"
  • Wait until an element with the class name main-content is found: ".main-content"
  • Wait until an element with the tag name table is found: "table"
  • Wait until an element with the tag name table or with the id main-content is found: "table, #main-content"
  • Wait until <p class="article"> is found within <div class="user-panel main">: "div.user-panel.main p.article"

--auto-detect-element-to-convert

The main HTML element for conversion is detected automatically. Use this when you want to extract article or main content without knowing the exact CSS selector, automatically excluding navigation and sidebars.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--auto-detect-element-to-convert[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--readability-enhancements

Automatically enhance the input HTML to improve readability by removing clutter and reformatting content. Use this when converting web pages with excessive navigation, ads, or sidebars that distract from the main content.

Different versions (v1-v4) use progressively aggressive algorithms - start with "v1" and increase if more cleanup is needed. Use this for converting blog posts, articles, or documentation into clean PDFs.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--readability-enhancements ENHANCEMENTS
Default:
none
Allowed Values:
  • none — No enhancements are used.
  • readability-v1 — Version 1 of the enhancements is used. Basic cleanup for simple pages with moderate clutter.
  • readability-v2 — Version 2 of the enhancements is used. More aggressive cleanup for pages with more ads and navigation.
  • readability-v3 — Version 3 of the enhancements is used. Strong cleanup for heavily cluttered pages with multiple sidebars.
  • readability-v4 — Version 4 of the enhancements is used. Maximum cleanup for extremely cluttered pages. May remove some content.

PDF Format

--enable-pdf-forms

Convert HTML forms to fillable PDF forms that users can complete in PDF readers. Use this to create interactive PDFs from HTML forms.

Use this for fillable applications, surveys, or order forms that work offline. Details can be found in the fillable PDF forms guide.

Syntax:
--enable-pdf-forms[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--linearize

Create linearized PDF. This is also known as Fast Web View. Use this to optimize PDFs for progressive download, allowing users to start viewing the first page while the rest downloads.

Syntax:
--linearize[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--encrypt

Encrypt the PDF to prevent search engines from indexing the contents and add an extra layer of security. Use this for confidential documents, internal reports, or any content you do not want appearing in search results.

Combine with a password to require authentication for viewing, or just use encryption alone to prevent indexing while keeping the PDF publicly readable.

Syntax:
--encrypt[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--user-password

Protect the PDF with a user password to restrict who can open and view the document. Recipients must enter this password to view the PDF. Use this for confidential documents, sensitive data, or content distribution where you want to control access.

Combine with permission flags to restrict what users can do after opening.

Syntax:
--user-password PASSWORD
Example:
  • Simple document password: "123456"

--owner-password

Protect the PDF with an owner password for administrative control. This password allows changing permissions, passwords, and document restrictions - like a master key. Use different user and owner passwords to give recipients restricted access while retaining full control.

The owner password should be kept confidential and different from the user password.

Syntax:
--owner-password PASSWORD
Example:
  • Admin access password: "123456"

--no-print

Disallow printing of the output PDF to protect sensitive content. Use this for confidential documents, copyrighted materials, or preview versions you want to restrict.

Syntax:
--no-print[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--no-modify

Disallow modification of the output PDF to maintain document integrity. Use this for official documents, contracts, or records that should not be altered after creation. Prevents recipients from editing content, adding annotations, or extracting pages.

Syntax:
--no-modify[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--no-copy

Disallow text and graphics extraction from the output PDF to protect copyrighted content. Use this for ebooks, proprietary documents, or materials where you want to prevent easy copying and redistribution.

Syntax:
--no-copy[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--title

Set the title of the PDF that appears in PDF reader title bars and document properties. Use descriptive titles for better organization and searchability in document management systems.

This metadata helps users identify documents when multiple PDFs are open and improves accessibility for screen readers.

Syntax:
--title TITLE
Example:
  • Personal CV title: "My Resume"

--subject

Set the subject of the PDF to categorize or summarize the document content. Use this to add searchable metadata for document management systems, improve organization in large PDF libraries, or provide context about the document's purpose.

Appears in PDF properties dialog.

Syntax:
--subject SUBJECT
Example:
  • Technical position subject: "CV - Software Developer"

--author

Set the author of the PDF for attribution and document tracking. Use this to identify who created the document, important for official documents, reports, or publications.

This metadata appears in PDF properties and helps with document management and version control.

Syntax:
--author AUTHOR
Example:
  • Document author name: "John Doe"

--keywords

Associate keywords with the document to improve searchability in document management systems. Use relevant terms that describe the content, making it easier to find documents later.

Separate multiple keywords with commas. Particularly useful for large document repositories or DAM systems.

Syntax:
--keywords KEYWORDS
Example:
  • Technical skills for searchability: "software developer, Unix, databases"

--extract-meta-tags

Extract meta tags (author, keywords and description) from the input HTML and automatically populate PDF metadata. Use this when converting web pages that already have proper HTML meta tags, saving you from manually setting title, author, and keywords.

Use this in automated conversion workflows where source HTML is well-structured.

Syntax:
--extract-meta-tags[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--conformance

Produce the output PDF at the specified PDF/A conformance level. PDF/A is the ISO-standardized archival format for long-term document preservation. Can not be combined with encryption options, fillable PDF forms, or watermarks and backgrounds.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--conformance CONFORMANCE
Allowed Values:
  • PDF/A-2a — PDF/A-2a - accessible documents, tagged structure and Unicode text.
  • PDF/A-2b — PDF/A-2b - reliable visual archiving, the most common choice.
  • PDF/A-2u — PDF/A-2u - visual archiving with searchable Unicode text.
  • PDF/A-3a — PDF/A-3a - PDF/A-2a plus file attachments.
  • PDF/A-3b — PDF/A-3b - PDF/A-2b plus file attachments.
  • PDF/A-3u — PDF/A-3u - PDF/A-2u plus file attachments.
  • PDF/A-4 — PDF/A-4 - the latest PDF/A, based on PDF 2.0.
  • PDF/A-4e — PDF/A-4e - PDF/A-4 for engineering, allows 3D and attachments.
  • PDF/A-4f — PDF/A-4f - PDF/A-4 with a mandatory file attachment.

--tagged-pdf

Create a tagged PDF that preserves the logical structure of the source HTML - headings, paragraphs, lists, links and reading order - as PDF structure tags. Use this to make documents accessible to screen readers and to improve text extraction and content reflow. Can not be combined with watermarks and backgrounds.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--tagged-pdf[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--attachment

Embed a file as an attachment in the output PDF. Call this method repeatedly to attach several files.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--attachment ATTACHMENT
Repeated values:
Repeat this option to supply more than one value.
Constraint:
  • The file must exist and not be empty.

Viewer Preferences

--page-layout

Control how pages appear when the PDF opens in viewers that respect these preferences. "single-page" for focused reading one page at a time. "one-column" for continuous scrolling like a web page. "two-column-left" for book-like layouts with odd pages on left (international standard). "two-column-right" for magazines with odd pages on right.

Syntax:
--page-layout LAYOUT
Allowed Values:
  • single-page — Display one page at a time.
  • one-column — Display the pages in one column.
  • two-column-left — Display the pages in two columns, with odd-numbered pages on the left.
  • two-column-right — Display the pages in two columns, with odd-numbered pages on the right.

--page-mode

Control the initial display mode when the PDF opens. "full-screen" for presentations and kiosk displays where you want an immersive experience. "thumbnails" for long documents where visual page navigation is helpful. "outlines" for structured documents with bookmarks/table of contents.

Syntax:
--page-mode MODE
Allowed Values:
  • full-screen — Full-screen mode.
  • thumbnails — Thumbnail images are visible.
  • outlines — Document outline is visible.

--initial-zoom-type

Control how the PDF is initially zoomed when opened.

Syntax:
--initial-zoom-type ZOOM_TYPE
Allowed Values:
  • fit-width — The page content is magnified just enough to fit the entire width of the page within the window.
  • fit-height — The page content is magnified just enough to fit the entire height of the page within the window.
  • fit-page — The page content is magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension.

--initial-page

Display the specified page when the document is opened.

Syntax:
--initial-page PAGE
Constraint:
  • Must be a positive integer.
Example:
  • Start at second page: 2

--initial-zoom

Specify the initial page zoom in percents when the document is opened.

Syntax:
--initial-zoom ZOOM
Constraint:
  • Must be a positive integer.
Example:
  • Half-size zoom level: 50

--hide-toolbar

Hide the viewer's toolbar when the PDF is opened to provide a cleaner, more focused reading experience. Use this for presentations, kiosk displays, or immersive reading where you want minimal UI distractions.

Syntax:
--hide-toolbar[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--hide-menubar

Hide the viewer's menu bar when the PDF is opened for a cleaner interface. Use this for kiosk mode, presentations, or embedded PDFs where you want to minimize UI elements.

Syntax:
--hide-menubar[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--hide-window-ui

Hide user interface elements like scroll bars and navigation controls when the PDF opens. Use this for presentation mode, digital signage, or embedded PDFs where you want the most minimal interface possible.

Combines with other UI hiding options for full-screen immersive viewing.

Syntax:
--hide-window-ui[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--fit-window

Resize the PDF viewer window to fit the size of the first displayed page when opened. Use this to ensure the PDF opens at an appropriate size rather than filling the entire screen.

Particularly useful for small documents, forms, or certificates that look better at actual size.

Syntax:
--fit-window[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--center-window

Position the PDF viewer window in the center of the screen when opened.

Syntax:
--center-window[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--display-title

Display the title of the HTML document in the PDF viewer's title bar instead of the filename. Use this to show more descriptive titles when PDFs are opened - particularly useful when the filename is cryptic or auto-generated.

Improves user experience by showing meaningful document names.

Syntax:
--display-title[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--right-to-left

Set the predominant reading order for text to right-to-left. This option has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up.

Syntax:
--right-to-left[=true|false]
Default:
false
Allowed Values:
  • true
  • false

Data

--data-string

Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.

Syntax:
--data-string DATA_STRING
Example:
  • Template variables for mail merge: "{"recipient": "Anna May", "sender": "John Doe"}"

--data-file

Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.

Syntax:
--data-file DATA_FILE
Example:
  • External data for template rendering: "/home/user/john/data.json"

--data-format

Specify the input data format. Use "auto" for automatic detection or explicitly set to JSON, XML, YAML, or CSV when format is known.

Syntax:
--data-format DATA_FORMAT
Default:
auto
Allowed Values:
  • auto — The data format is auto-detected.
  • json
  • xml
  • yaml
  • csv

--data-encoding

Set the encoding of the input data file.

Syntax:
--data-encoding ENCODING
Default:
utf-8
Example:
  • Set to use Latin-2 encoding: "iso8859-2"

--data-ignore-undefined

Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.

Syntax:
--data-ignore-undefined[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--data-auto-escape

Auto escape HTML symbols in the input data before placing them into the output.

Syntax:
--data-auto-escape[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--data-trim-blocks

Auto trim whitespace around each template command block.

Syntax:
--data-trim-blocks[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--data-variable-markers

Set the markers that delimit variable expressions in the template. The default Jinja2 syntax uses {{ and }}, which can clash with other systems (e.g. Zapier) that interpret double braces. Use an alternative style to avoid the conflict. Block markers {% %} and comment markers {# #} are not affected.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--data-variable-markers MARKERS
Default:
standard
Allowed Values:
  • standard — Standard Jinja2 variable syntax: .
  • square — Square-bracket syntax: [[ name ]].
  • angle — Angle-bracket syntax: << name >>.

--data-options

Set the advanced data options as comma separated key=value pairs:
  • csv_delimiter - The CSV data delimiter, the default is ,.
  • xml_remove_root - Remove the root XML element from the input data.
  • data_root - The name of the root element inserted into the input data without a root node (e.g. CSV), the default is data.
Syntax:
--data-options OPTIONS
Examples:
  • Use semicolon to separate CSV data: "csv_delimiter=;"
  • Name the root of data rows and use the name in the template loop {% for row in rows %}...{% endfor %}: "data_root=rows"
  • Remove XML root so the HTML template can be simpler: "xml_remove_root=1"

Miscellaneous

--debug-log

Turn on debug logging to troubleshoot conversion issues. Details about the conversion process, including resource loading, rendering steps, and error messages are stored in the debug log. Use this when conversions fail or produce unexpected results.

Syntax:
--debug-log[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--tag

Tag the conversion with a custom value for tracking and analytics. Use this to categorize conversions by customer ID, document type, or business unit. The tag appears in conversion statistics. A value longer than 32 characters is cut off.

Syntax:
--tag TAG
Example:
  • Track job in analytics: "client-1234"

--http-proxy

A proxy server used by the conversion process for accessing the source URLs with HTTP scheme. This can help circumvent regional restrictions or provide limited access to your intranet.

Syntax:
--http-proxy PROXY
Constraint:
  • The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
Examples:
  • Corporate proxy server: "myproxy.com:8080"
  • Direct IP proxy connection: "113.25.84.10:33333"

--https-proxy

A proxy server used by the conversion process for accessing the source URLs with HTTPS scheme. This can help circumvent regional restrictions or provide limited access to your intranet.

Syntax:
--https-proxy PROXY
Constraint:
  • The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
Examples:
  • Secure proxy for HTTPS: "myproxy.com:443"
  • Direct secure proxy IP: "113.25.84.10:44333"

--client-certificate

A client certificate to authenticate the converter on your web server. The certificate is used for two-way SSL/TLS authentication (mutual TLS) and adds extra security. Use this when converting content from servers that require client certificate authentication for access.

Syntax:
--client-certificate CERTIFICATE
Constraint:
  • The file must exist and not be empty.
Example:
  • Custom CA certificate path: "/home/user/john/pdfcrowd.crt"

--client-certificate-password

A password for the PKCS12 file with a client certificate if the certificate file is password-protected.

Syntax:
--client-certificate-password PASSWORD
Example:
  • PKCS12 certificate password: "123456"

Tweaks

--layout-dpi

Set the internal DPI resolution used for positioning of PDF contents. It can help in situations where there are small inaccuracies in the PDF. It is recommended to use values that are a multiple of 72, such as 288 or 360.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--layout-dpi DPI
Constraint:
  • The accepted range is 72-600.
Default:
300
Example:
  • Low DPI for faster processing: 144

--content-area-x

Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.

Syntax:
--content-area-x X
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
Default:
0in
Examples:
  • Extend content beyond left margin: "-1in"
  • Slight inset from print edge: "10mm"

--content-area-y

Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.

Syntax:
--content-area-y Y
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
Default:
0in
Examples:
  • Extend content beyond left margin: "-1in"
  • Slight inset from print edge: "10mm"

--content-area-width

Set the width of the content area. It should be at least 1 inch.

Syntax:
--content-area-width WIDTH
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
The width of the print area.
Examples:
  • Content for letter-width viewport: "8in"
  • Content for A4 portrait layout: "210mm"

--content-area-height

Set the height of the content area. It should be at least 1 inch.

Syntax:
--content-area-height HEIGHT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Default:
The height of the print area.
Examples:
  • Content for letter-width viewport: "8in"
  • Content for A4 portrait layout: "210mm"

--content-area

Set the content area position and size. The content area enables you to specify a web page area to be converted.

Syntax:
--content-area X Y WIDTH HEIGHT
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
Constraint:
  • The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.

--contents-matrix

A 2D transformation matrix applied to the main contents on each page. The origin [0,0] is located at the top-left corner of the contents. The resolution is 72 dpi.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--contents-matrix MATRIX
Default:
1,0,0,0,1,0
Examples:
  • Fine tune the contents height: "1,0,0,0,1.001,0"
  • Translate the contents by -10 points in both directions: "1,0,-10,0,1,-10"

--header-matrix

A 2D transformation matrix applied to the page header contents. The origin [0,0] is located at the top-left corner of the header. The resolution is 72 dpi.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--header-matrix MATRIX
Default:
1,0,0,0,1,0
Examples:
  • Fine tune the header contents height: "1,0,0,0,1.001,0"
  • Translate the header contents by -10 points in both directions: "1,0,-10,0,1,-10"

--disable-page-height-optimization

Disable automatic height adjustment that compensates for pixel to point rounding errors.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--disable-page-height-optimization[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--main-document-css-annotation

Add special CSS classes to the main document's body element. This allows applying custom styling based on these classes:
  • pdfcrowd-page-X - where X is the current page number
  • pdfcrowd-page-odd - odd page
  • pdfcrowd-page-even - even page
Availability:
Converter >= 20.10. See versioning.
Syntax:
--main-document-css-annotation[=true|false]
Default:
false
Allowed Values:
  • true
  • false
Example:

--max-loading-time

Set the maximum time for loading the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.

Availability:
Converter >= 20.10. See versioning.
Syntax:
--max-loading-time MAX_TIME
Constraint:
  • The accepted range is 10-30.

--conversion-config

Configure conversion via JSON. The configuration defines various page settings for individual PDF pages or ranges of pages. It provides flexibility in designing each page of the PDF, giving control over each page's size, header, footer, etc. If a page or parameter is not explicitly specified, the system will use the default settings for that page or attribute. If a JSON configuration is provided, the settings in the JSON will take precedence over the global options.

The structure of the JSON must be:

  • pageSetup: An array of objects where each object defines the configuration for a specific page or range of pages. The following properties can be set for each page object:
    • pages: A comma-separated list of page numbers or ranges. Special strings may be used, such as odd, even, and last. For example:
      • 1-: from page 1 to the end of the document
      • 2: only the 2nd page
      • 2,4,6: pages 2, 4, and 6
      • 2-5: pages 2 through 5
      • odd,2: the 2nd page and all odd pages
    • pageSize: The page size (optional). Possible values: A0, A1, A2, A3, A4, A5, A6, Letter.
    • pageWidth: The width of the page (optional).
    • pageHeight: The height of the page (optional).
    • marginLeft: Left margin (optional).
    • marginRight: Right margin (optional).
    • marginTop: Top margin (optional).
    • marginBottom: Bottom margin (optional).
    • displayHeader: Header appearance (optional). Possible values:
      • none: completely excluded
      • space: only the content is excluded, the space is used
      • content: the content is printed (default)
    • displayFooter: Footer appearance (optional). Possible values:
      • none: completely excluded
      • space: only the content is excluded, the space is used
      • content: the content is printed (default)
    • headerHeight: Height of the header (optional).
    • footerHeight: Height of the footer (optional).
    • orientation: Page orientation, such as "portrait" or "landscape" (optional).
    • backgroundColor: Page background color in RRGGBB or RRGGBBAA hexadecimal format (optional).

Dimensions may be empty, 0 or specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".

Availability:
Converter >= 24.04. See versioning.
Syntax:
--conversion-config JSON_STRING
Examples:
  • Modify the margins and orientation, and hide the header and footer on some pages.
    {
      "pageSetup": [
        {
          "pages": "1,3",
          "marginLeft": "72pt",
          "marginRight": "72pt",
          "marginTop": "72pt",
          "marginBottom": "72pt",
          "displayHeader": "content",
          "displayFooter": "none"
        },
        {
          "pages": "2-5",
          "orientation": "landscape",
          "marginTop": "0",
          "marginBottom": "0",
          "headerHeight": "1cm",
          "displayHeader": "content",
          "displayFooter": "none"
        },
        {
          "pages": "10",
          "pageWidth": "6in",
          "pageHeight": "10in",
          "displayHeader": "none",
          "displayFooter": "content"
        },
        {
          "pages": "last",
          "backgroundColor": "00ff0080"
        }
      ]
    }
    
  • A header is placed only on the first page, and a footer only on the last page. No space is occupied on other pages.
    {
      "pageSetup": [
        {
          "pages": "1-",
          "displayHeader": "none",
          "displayFooter": "none"
        },
        {
          "pages": "1",
          "displayHeader": "content"
        },
        {
          "pages": "last",
          "displayFooter": "content"
        }
      ]
    }
    

--conversion-config-file

Configure the conversion process via JSON file. See details of the JSON string.

Availability:
Converter >= 24.04. See versioning.
Syntax:
--conversion-config-file FILEPATH
Constraint:
  • The file must exist and not be empty.
Examples:
  • External conversion settings: "/home/user/john/conv_config.json"
  • see example of the JSON string

--converter-user-agent

Specify the User-Agent HTTP header that will be used by the converter when a request is made to the converted web page.

Syntax:
--converter-user-agent AGENT
Default:
latest-chrome-desktop
Allowed Values:
  • chrome-desktop — The user-agent for desktop chrome corresponding to the converter used.
  • chrome-mobile — The user-agent for mobile chrome corresponding to the converter used.
  • latest-chrome-desktop — The user-agent of the recently released Chrome browser on desktops.
  • latest-chrome-mobile — The user-agent of the recently released Chrome browser on mobile devices.
  • custom string — A custom string for the user agent.
Examples:
  • Mimic the recent chrome on mobiles: "latest-chrome-mobile"
  • Mimic Safari 18.0 browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15"

API Client Options

--converter-version

Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.

Syntax:
--converter-version VERSION
Default:
24.04
Allowed Values:
  • 24.04 — Version 24.04.
  • 20.10 — Version 20.10.
  • 18.10 — Version 18.10.

--use-http

Specify whether to use HTTP or HTTPS when connecting to the PDFCrowd API.

Syntax:
--use-http[=true|false]
Default:
false
Allowed Values:
  • true
  • false

--client-user-agent

Specify the User-Agent HTTP header the CLI sends to the PDFCrowd API.

Syntax:
--client-user-agent AGENT
Default:
pdfcrowd_cli_client/1.1.0 (https://pdfcrowd.com)

--proxy

Specify an HTTP proxy the CLI uses to connect to the PDFCrowd API.

Syntax:
--proxy HOST PORT USER_NAME PASSWORD

--retry-count

Specify the number of automatic retries when a 502 or 503 HTTP status code is received. The status code indicates a temporary network issue. This feature can be disabled by setting to 0.

Syntax:
--retry-count COUNT
Default:
1
Example:
  • Retry failed requests three times: 3