Conversion Input
url
The address of the web page to convert.
- Constraint:
-
- Supported protocols are http:// and https://.
file
The path to a local file to convert.
The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip).
If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets.
- Constraints:
-
- The file must exist and not be empty.
- The file name must have a valid extension.
text
The string content to convert.
zip_main_filename
Set the file name of the main HTML document stored in the input archive. If not specified, the first HTML file in the archive is used for conversion. Use this method if the input archive contains multiple HTML documents.
Response
output_name
The file name of the created file (max 180 chars). If not specified then the name is auto-generated.
content_disposition
The value of the Content-Disposition HTTP header sent in the response.
- Default:
attachment
- Allowed Values:
-
-
attachment
— Forces the browser to pop up a Save As dialog. -
inline
— The browser will open the result file in the browser window.
-
Page Setup
page_size
Set the output page size.
- Default:
A4
- Allowed Values:
-
-
A0
-
A1
-
A2
-
A3
-
A4
-
A5
-
A6
-
Letter
-
page_width
Set the output page width. The safe maximum is 200in
otherwise some PDF viewers may be unable to open the PDF.
- 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
-
A4 landscape / A3 portrait width:
page_height
Set the output page height. Use -1
for a single page PDF. The safe maximum is 200in
otherwise some PDF viewers may be unable to open the PDF.
- 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
-
A3 standard height for large format:
orientation
Set the output page orientation.
- Default:
portrait
- Allowed Values:
-
-
landscape
-
portrait
-
margin_top
Set the output page top margin.
- 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 professional margin:
10mm
-
Wide margin for binding:
margin_right
Set the output page right margin.
- 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 professional margin:
10mm
-
Wide margin for binding:
margin_bottom
Set the output page bottom margin.
- 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 professional margin:
10mm
-
Wide margin for binding:
margin_left
Set the output page left margin.
- 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 professional margin:
10mm
-
Wide margin for binding:
no_margins
Disable page margins.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
print_page_range
Set the page range to print.
- Constraint:
-
- A comma separated list of page numbers or ranges. Special strings may be used, such as 'odd', 'even' and 'last'.
- Examples:
-
-
Just the second page is printed:
2
-
The first, third, and last pages are printed:
1,3,last
-
Everything except the first page is printed:
2-
-
Just first 3 pages are printed:
-3
-
Pages 3, 6, 7, 8 and 9 are printed:
3,6-9
-
Just the second page is printed:
content_viewport_width
Set the viewport width for formatting the HTML content when generating a PDF. By specifying a viewport width, you can control how the content is rendered, ensuring it mimics the appearance on various devices or matches specific design requirements.
- Availability:
- Available for converters >= 24.04. See versioning.
- Constraint:
-
- The value must be 'balanced', 'small', 'medium', 'large', 'extra-large', or a number in the range 96-65000px.
- Default:
medium
- Allowed Values:
-
-
balanced
— The smart option to adjust the viewport width dynamically to fit the print area, ensuring an optimal layout. -
small
— A compact layout where less text fits on each PDF page, ideal for detailed sections or mobile views. -
medium
— A balanced amount of text per page, striking a good compromise between readability and content density. -
large
— A broader layout that accommodates more text per page, perfect for reducing page count and enhancing flow. -
extra-large
— Maximize the text per page, creating a spacious and content-rich PDF, akin to a widescreen experience. -
pixel width
— A precise viewport width in pixels, such as1024px
, 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
-
Use the "large" viewport:
content_viewport_height
Set the viewport height for formatting the HTML content when generating a PDF. By specifying a viewport height, you can enforce loading of lazy-loaded images and also affect vertical positioning of absolutely positioned elements within the content.
- Availability:
- Available for converters >= 24.04. See versioning.
- Constraint:
-
- The value must be 'auto', 'large', or a number.
- Default:
auto
- Allowed Values:
-
-
auto
— The height of the print area is used. -
large
— Value suitable for documents with extensive lazy-loaded content. -
pixel height
— A specific numerical value, such as10000px
, 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
-
Load all lazy images and content:
content_fit_mode
Specifies the mode for fitting the HTML content to the print area by upscaling or downscaling it.
- Availability:
- Available for converters >= 24.04. See versioning.
- Default:
auto
- Allowed Values:
-
-
auto
— Automatic mode -
smart-scaling
— Smartscaling to fit more content into the print area. -
no-scaling
— No scaling is performed. -
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
Specifies which blank pages to exclude from the output document.
- Availability:
- Available for converters >= 20.10. See versioning.
- 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 a watermark to each page of the output PDF file. 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.
- 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
-
Multi-page PDF for watermarking:
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.
- 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
-
Download watermark from server:
multipage_watermark
Apply each page of a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.
- 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
-
Multi-page PDF for watermarking:
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.
- 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
-
Download watermark from server:
page_background
Apply a background to each page of the output PDF file. 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.
- 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
-
PDF template background:
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.
- Constraint:
-
- Supported protocols are http:// and https://.
- Examples:
-
-
Download template background:
http://myserver.com/background.pdf
-
Remote background pattern:
http://myserver.com/background.png
-
Download template background:
multipage_background
Apply each page of a background to the corresponding page of the output PDF. A background can be either a PDF or an image.
- 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
-
PDF template background:
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.
- Constraint:
-
- Supported protocols are http:// and https://.
- Examples:
-
-
Download template background:
http://myserver.com/background.pdf
-
Remote background pattern:
http://myserver.com/background.png
-
Download template background:
page_background_color
The page background color in RGB or RGBA hexadecimal format. The color fills the entire page regardless of the margins.
- Constraint:
-
- The value must be in RRGGBB or RRGGBBAA hexadecimal format.
- Examples:
-
-
red color:
FF0000
-
green color:
00ff00
-
green color with 50% opacity:
00ff0080
-
red color:
General Options
use_print_media
Use the print version of the page if available (@media print).
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
no_background
Do not print the background graphics.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
disable_javascript
Do not execute JavaScript.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
disable_image_loading
Do not load images.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
disable_remote_fonts
Disable loading fonts from remote sources.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
use_mobile_user_agent
Use a mobile user agent.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
load_iframes
Specifies how iframes are handled.
- Availability:
- Available for converters >= 20.10. See versioning.
- 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
Try to block ads. Enabling this option can produce smaller output and speed up the conversion.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
default_encoding
Set the default HTML content text encoding.
- Default:
auto detect
- Examples:
-
-
Set to use Latin-2 encoding:
iso8859-2
-
Set to use UTF-8 encoding:
utf-8
-
Set to use Latin-2 encoding:
locale
Set the locale for the conversion. This may affect the output format of dates, times and numbers.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
en-US
- Example:
-
-
Set to use Japanese locale:
ja-JP
-
Set to use Japanese locale:
http_auth_user_name
Set the HTTP authentication user name.
- Example:
-
-
HTTP auth username:
John
-
HTTP auth username:
http_auth_password
Set the HTTP authentication password.
- Example:
-
-
Simple password for protected sites:
123456
-
Simple password for protected sites:
verify_ssl_certificates
Do not allow insecure HTTPS connections.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
fail_on_main_url_error
Abort the conversion if the main URL HTTP status code is greater than or equal to 400.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
fail_on_any_url_error
Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400 or if some sub-requests are still pending. See details in a debug log.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
no_xpdfcrowd_header
Do not send the X-Pdfcrowd HTTP header in PDFCrowd HTTP requests.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
css_page_rule_mode
Specifies behavior in presence of CSS @page rules. It may affect the page size, margins and orientation.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
default
- Allowed Values:
-
-
default
— The PDFCrowd API page settings are preferred. -
mode1
— The converter version 18.10 mode. -
mode2
— CSS @page rule is preferred.
-
custom_css
Apply custom CSS to the input HTML document. It allows you to modify the visual appearance and layout of your HTML content dynamically. Tip: Using !important
in custom CSS provides a way to prioritize and override conflicting styles.
- Availability:
- Available for converters >= 20.10. See versioning.
- Examples:
-
-
Set the page background color to gray:
body { background-color: gray; }
-
Do not show
nav
HTML elements and the element withad-block
ID in the output PDF:nav, #ad-block { display: none !important; }
-
Set the page background color to gray:
custom_javascript
Run a custom JavaScript after the document is loaded and ready to print. 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.
- Example:
-
-
Set the page background color to gray:
document.body.style.setProperty('background-color', 'gray', 'important')
-
Set the page background color to gray:
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.
- Example:
-
-
Set the page background color to gray:
document.body.style.setProperty('background-color', 'gray', 'important')
-
Set the page background color to gray:
custom_http_header
Set a custom HTTP header to be included in all requests made by the converter.
- Constraint:
-
- A string containing the header name and value separated by a colon.
- Example:
-
-
API client tracking header:
X-My-Client-ID:k2017-12345
-
API client tracking header:
javascript_delay
Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. Your license defines the maximum wait time by "Max Delay" parameter.
- Constraint:
-
- Must be a positive integer or 0.
- Default:
200
- Example:
-
-
Wait for 2 seconds:
2000
-
Wait for 2 seconds:
element_to_convert
Convert only the specified element from the main document and its children. 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.
- 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 idmain-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
-
The first element with the id
element_to_convert_mode
Specify the DOM handling when only a part of the document is converted. This can affect the CSS rules used.
- 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. -
hide-siblings
— All element's siblings are hidden.
-
wait_for_element
Wait for the specified element in a source document. 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 "Max Delay" parameter.
- 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 idmain-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
-
Wait until an element with the id
auto_detect_element_to_convert
The main HTML element for conversion is detected automatically.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
readability_enhancements
The input HTML is automatically enhanced to improve the readability.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
none
- Allowed Values:
-
-
none
— No enhancements are used. -
readability-v1
— Version 1 of the enhancements is used. -
readability-v2
— Version 2 of the enhancements is used. -
readability-v3
— Version 3 of the enhancements is used. -
readability-v4
— Version 4 of the enhancements is used.
-
Print Resolution
viewport_width
Set the viewport width in pixels. The viewport is the user's visible area of the page.
- Constraint:
-
- The accepted range is 96-65000.
- Example:
-
-
Full HD width:
1920
-
Full HD width:
viewport_height
Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000.
- Constraint:
-
- Must be a positive integer.
- Example:
-
-
Tall viewport for scrolling content:
15000
-
Tall viewport for scrolling content:
rendering_mode
Set the rendering mode of the page, allowing control over how content is displayed.
- Allowed Values:
-
-
default
— The mode based on the standard browser print functionality. -
viewport
— Adapts the rendering according to the specified viewport width, influencing the @media (min-width) and @media (max-width) CSS properties. This mode is ideal for previewing different responsive designs of a web page, such as mobile or desktop views, by choosing the appropriate viewport size.
-
smart_scaling_mode
Specifies the scaling mode used for fitting the HTML contents to the print area.
- Allowed Values:
-
-
default
— The mode based on the standard browser print functionality. -
disabled
— No smart scaling is performed. -
viewport-fit
— The viewport width fits the print area width. -
content-fit
— The HTML contents width fits the print area width. -
single-page-fit
— The whole HTML contents fits the print area of a single page. -
single-page-fit-ex
— The whole HTML contents fits the print area of a single page with respect to the page height/width ratio. -
mode1
— Scaling mode 1 is applied.
-
scale_factor
Set the scaling factor (zoom) for the main page area.
- Constraint:
-
- The accepted range is 10-500.
- Default:
100
- Example:
-
-
Shrink content to fit small page:
50
-
Shrink content to fit small page:
disable_smart_shrinking
Disable the intelligent shrinking strategy that tries to optimally fit the HTML contents to a PDF page.
- Availability:
- Available for converter 18.10 only. See versioning.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
jpeg_quality
Set the quality of embedded JPEG images. A lower quality results in a smaller PDF file but can lead to compression artifacts.
- Constraint:
-
- The accepted range is 1-100.
- Default:
100
- Example:
-
-
Set 70% quality as a compromise between image quality and image size:
70
-
Set 70% quality as a compromise between image quality and image size:
convert_images_to_jpeg
Specify which image types will be converted to JPEG. Converting lossless compression image formats (PNG, GIF, ...) to JPEG may result in a smaller PDF file.
- Default:
none
- Allowed Values:
-
-
none
— No image conversion is done. -
opaque
— Only opaque images are converted to JPEG images. -
all
— All images are converted to JPEG images. The JPEG format does not support transparency so the transparent color is replaced by a PDF page background color.
-
image_dpi
Set the DPI of images in PDF. A lower DPI may result in a smaller PDF file. If the specified DPI is higher than the actual image DPI, the original image DPI is retained (no upscaling is performed). Use 0
to leave the images unaltered.
- Constraint:
-
- Must be a positive integer or 0.
- Examples:
-
-
No change of the source image is done:
0
-
Screen-only view lower DPI:
72
-
Screen-only view recommended DPI:
96
-
Ebook typical DPI:
150
-
Printer standard DPI:
300
-
No change of the source image is done:
PDF Format
Miscellaneous values for PDF output.
enable_pdf_forms
Convert HTML forms to fillable PDF forms. Details can be found in the blog post.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
linearize
Create linearized PDF. This is also known as Fast Web View.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
encrypt
Encrypt the PDF. This prevents search engines from indexing the contents.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
user_password
Protect the PDF with a user password. When a PDF has a user password, it must be supplied in order to view the document and to perform operations allowed by the access permissions.
- Example:
-
-
Simple document password:
123456
-
Simple document password:
owner_password
Protect the PDF with an owner password. Supplying an owner password grants unlimited access to the PDF including changing the passwords and access permissions.
- Example:
-
-
Admin access password:
123456
-
Admin access password:
no_print
Disallow printing of the output PDF.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
no_modify
Disallow modification of the output PDF.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
no_copy
Disallow text and graphics extraction from the output PDF.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
title
Set the title of the PDF.
- Example:
-
-
Personal CV title:
My Resume
-
Personal CV title:
subject
Set the subject of the PDF.
- Example:
-
-
Technical position subject:
CV - Software Developer
-
Technical position subject:
keywords
Associate keywords with the document.
- Example:
-
-
Technical skills for searchability:
software developer, Unix, databases
-
Technical skills for searchability:
Viewer Preferences
These preferences specify how a PDF viewer should present the document. The preferences may be ignored by some PDF viewers.
page_layout
Specify the page layout to be used when the document is opened.
- 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
Specify how the document should be displayed when opened.
- Allowed Values:
-
-
full-screen
— Full-screen mode. -
thumbnails
— Thumbnail images are visible. -
outlines
— Document outline is visible.
-
initial_zoom_type
Specify how the page should be displayed when opened.
- 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.
- Constraint:
-
- Must be a positive integer.
- Example:
-
-
Start at second page:
2
-
Start at second page:
initial_zoom
Specify the initial page zoom in percents when the document is opened.
- Constraint:
-
- Must be a positive integer.
- Example:
-
-
Half-size zoom level:
50
-
Half-size zoom level:
hide_toolbar
Specify whether to hide the viewer application's tool bars when the document is active.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
hide_window_ui
Specify whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
fit_window
Specify whether to resize the document's window to fit the size of the first displayed page.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
center_window
Specify whether to position the document's window in the center of the screen.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
display_title
Specify whether the window's title bar should display the document title. If false , the title bar should instead display the name of the PDF file containing the document.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
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
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
Data
Methods related to HTML template rendering.
data_string
Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
- Example:
-
-
Template variables for mail merge:
{"recipient": "Anna May", "sender": "John Doe"}
-
Template variables for mail merge:
data_file
Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
- Example:
-
-
External data for template rendering:
/home/user/john/data.json
-
External data for template rendering:
data_format
Specify the input data format.
- Default:
auto
- Allowed Values:
-
-
auto
— the data format is auto detected -
json
-
xml
-
yaml
-
csv
-
data_encoding
Set the encoding of the data file set by data_file.
- Default:
utf-8
- Example:
-
-
Set to use Latin-2 encoding:
iso8859-2
-
Set to use Latin-2 encoding:
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.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
data_auto_escape
Auto escape HTML symbols in the input data before placing them into the output.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
data_trim_blocks
Auto trim whitespace around each template command block.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
data_options
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 isdata
.
- 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 it the HTML template can be more simple:
xml_remove_root=1
-
Use semicolon to separate CSV data:
Miscellaneous
debug_log
Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log is returned in the x-pdfcrowd-debug-log response header or available in conversion statistics.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
tag
Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
- Example:
-
-
Track job in analytics:
client-1234
-
Track job in analytics:
http_proxy
A proxy server used by the conversion process for accessing the source URLs with HTTP scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
- 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
-
Corporate proxy server:
https_proxy
A proxy server used by the conversion process for accessing the source URLs with HTTPS scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
- 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
-
Secure proxy for HTTPS:
client_certificate
A client certificate to authenticate the converter on your web server. The certificate is used for two-way SSL/TLS authentication and adds extra security.
- Constraint:
-
- The file must exist and not be empty.
- Example:
-
-
Custom CA certificate path:
/home/user/john/pdfcrowd.crt
-
Custom CA certificate path:
client_certificate_password
A password for PKCS12 file with a client certificate if it is needed.
- Example:
-
-
PKCS12 certificate password:
123456
-
PKCS12 certificate password:
Tweaks
Expert options for fine-tuning output.
layout_dpi
Set the internal DPI resolution used for positioning of PDF contents. It can help in situations when 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:
- Available for converters >= 20.10. See versioning.
- Constraint:
-
- The accepted range is 72-600.
- Default:
300
- Example:
-
-
Low DPI for faster processing:
144
-
Low DPI for faster processing:
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.
- 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
-
Extend content beyond left margin:
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.
- 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
-
Extend content beyond left margin:
content_area_width
Set the width of the content area. It should be at least 1 inch.
- 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 for letter-width viewport:
content_area_height
Set the height of the content area. It should be at least 1 inch.
- 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 for letter-width viewport:
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:
- Available for converters >= 20.10. See versioning.
- 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
-
Fine tune the contents height:
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:
- Available for converters >= 20.10. See versioning.
- 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
-
Fine tune the header contents height:
disable_page_height_optimization
Disable automatic height adjustment that compensates for pixel to point rounding errors.
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
main_document_css_annotation
pdfcrowd-page-X
- where X is the current page numberpdfcrowd-page-odd
- odd pagepdfcrowd-page-even
- even page
- Availability:
- Available for converters >= 20.10. See versioning.
- Default:
false
- Allowed Values:
-
-
true, 1 or on
-
false, 0 or off
-
- Example:
-
-
CSS styling by page number in API Playground
-
max_loading_time
Set the maximum time to load 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:
- Available for converters >= 20.10. See versioning.
- Constraint:
-
- The accepted range is 10-30.
conversion_config
Allows to 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).
-
pages:
A comma-separated list of page numbers or ranges.
Special strings may be used, such as `odd`, `even` and `last`.
For example:
Dimensions may be empty, 0 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
- Availability:
- Available for converters >= 24.04. See versioning.
- 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
Allows to configure the conversion process via JSON file. See details of the JSON string.
- Availability:
- Available for converters >= 24.04. See versioning.
- 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
-
External conversion settings:
converter_user_agent
Specifies the User-Agent HTTP header that will be used by the converter when a request is made to the converted web page.
- Availability:
- See versioning.
- 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
-
Mimic the recent chrome on mobiles: