Web to PDF API Overview
Turn any website (URL input) into a pixel‑perfect PDF using a modern headless browser renderer. Control viewport and page layout with size, orientation, custom width/height, margins, and page ranges. Add headers and footers, keep backgrounds, pin fixed elements, and fine‑tune pagination by avoiding or inserting page breaks around specific selectors. For dynamic sites, run JavaScript, wait for an element, and inject your own JS/CSS. Access gated content with custom headers, cookies, and basic auth; block ads and cookie‑consent banners; hide elements; and adjust timeouts/delays for reliable rendering.
Full CSS & JS Rendering
Control loading time, JavaScript execution, and CSS styling.
Block Ads and Cookie Consent
Enable AdBlocker to remove unwanted ads, and hide cookie consent dialogs.
Control Image Quality
Adjust image compression and DPI for lighter or sharper PDFs.
Wait for Elements
Delay rendering until specific elements are loaded or ready.
Set Authentication & Cookies
Pass custom cookies, headers, and auth tokens easily.
Header & Footer Templates
Add dynamic headers, footers, page numbers, and titles.
Customizable Parameters
Fine-tune your automation with these powerful conversion options
Url
UriURI of a web page to convert. If URI has special characters like ? or & they must be encoded.
ConversionDelay
Integer Default: 0Delay in seconds before page load and PDF creation. Sometimes useful to let web page fully load.
Range: 0 .. 30Version
Collection Default: 148Specify a particular version of the Chromium engine to render the web page.
Values: latest 146 147 148AdBlock
Bool Default: FalseBlock ads in converting page.
CookieConsentBlock
Bool Default: FalseTries to remove EU regulation required cookie warnings from web pages.
JavaScript
Bool Default: TrueAllow web pages to run JavaScript.
WaitElement
StringElement selector string of the DOM element. Converter will wait for this element to appear in DOM before conversion begins.
UserJs
StringExecute provided JavaScript before conversion begins.
UserCss
StringApply additional CSS before conversion begins.
HideElements
StringElement selector string of the DOM elements that needs to be hidden during conversion.
CssMediaType
String Default: screenUse CSS media type in conversion process. The default screen and print media types are supported but not limited to these. The custom media type, like convertapi can be used too.
Headers
StringSet custom HTTP headers to include in the request. Format: Header1:Value1|Header2:Value2|Header3:Value3
- Each header is separated by
|. - Each name/value pair is separated by
:.
LoadLazyContent
Bool Default: FalseLoad page images that loads only when they are visible.
ViewportWidth
Integer Default: 1366Sets browser viewport width.
Range: 200 .. 4000ViewportHeight
Integer Default: 1024Sets browser viewport height.
Range: 200 .. 4000Background
Bool Default: TrueConvert web page background.
FixedElements
Collection Default: fixedChange fixed elements CSS 'position' property to adapt page for conversion.
Values: fixed absolute relative hideShowElements
StringElement selector string of the DOM elements that should be visible during conversion. Other elements will be hidden.
AvoidBreakElements
StringCSS selector for the elements that pages should not break.
BreakBeforeElements
StringCSS selector for the elements that should apply page break before it.
BreakAfterElements
StringCSS selector for the elements that should apply page break after it.
AuthUsername
StringHTTP authentication username. Could be used if conversion web page is protected with HTTP authentication.
AuthPassword
StringHTTP authentication password. Could be used if conversion web page is protected with HTTP authentication.
Cookies
StringSet additional cookies for the page request. Example: cookiename1=cookievalue1; cookiename2=cookievalue2; cookiename3=cookievalue3
RespectViewport
Bool Default: TrueIf true, the converter will generate PDF as the content looks like in the browser. If is set to false, the converter acts like Chrome print to PDF function.
Scale
Integer Default: 100Set web page scale value in percentage.
Range: 10 .. 200PageOrientation
Collection Default: portraitPDF page orientation.
Values: portrait landscapePageSize
Collection Default: letterPDF page size.
Values: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 letter legal ledgerMarginTop
Integer Default: 10Set the page top margin in millimeters (mm).
Range: 0 .. 500MarginRight
Integer Default: 10Set the page right margin in millimeters (mm).
Range: 0 .. 500MarginBottom
Integer Default: 10Set the page bottom margin in millimeters (mm).
Range: 0 .. 500MarginLeft
Integer Default: 10Set the page left margin in millimeters (mm).
Range: 0 .. 500Header
StringThis property will insert an HTML header into each page. HTML tags containing the classes pageNumber, totalPages, title, and date will be filled in with the metadata relevant to each individual page. Inline CSS could be utilized to style the HTML provided.
<style>
.right {
float: right;
}
.left {
float: left;
}
</style>
<span class='left'>
page number
<span class='pageNumber'></span>
</span>
<span class='right'>
date
<span class='date'></span>
</span>
Footer
StringThis property will insert an HTML footer into each page. HTML tags containing the classes pageNumber, totalPages, title, and date will be filled in with the metadata relevant to each individual page. Inline CSS could be utilized to style the HTML provided.
<style>
.right {
float: right;
}
.left {
float: left;
}
</style>
<span class='left'>
page number
<span class='pageNumber'></span>
</span>
<span class='right'>
date
<span class='date'></span>
</span>
PageWidth
IntegerCustom page width in millimeters (mm). This option override PageSize option.
Range: 10 .. 30000PageHeight
IntegerCustom page height in millimeters (mm). This option override PageSize option.
Range: 10 .. 30000PageRange
String Default: 1-100Set page range. Example 1-10 or 1,2,5.
StoreFile
Bool Default: FalseWhen the StoreFile parameter is set to True, your converted file is written to ConvertAPI’s encrypted, temporary storage and made available via a time-limited secure download URL, valid for up to 3 hours. After this period, the file is permanently deleted.
When StoreFile is set to False, conversion happens entirely in-memory. The raw file bytes are streamed back in the API response without touching disk or external storage, ensuring maximum security and zero persistence so that only you can access the content.
Integrate within minutes
Easy Web to PDF automation using our simple REST-API
Businesses trust us
Highest rated File Conversion API on major B2B software listing platforms: Capterra, G2, and Trustpilot.
"ConvertAPI has been a game-changer for our document automation workflows. Their conversion accuracy and API reliability are unmatched in the industry for over 7 years."
"ConvertAPI is a reliable, cost-effective solution with a proven track record of stability. It has grown significantly in maturity, adopting enterprise-grade practices over the years."
"We've integrated ConvertAPI across our entire document processing platform. The performance is exceptional and the support team is always responsive. Highly recommended!"
Enterprise-Grade Security
We ensure that all document processing is handled securely in the cloud, adhering to industry-leading standards like ISO 27001, GDPR, and HIPAA. To enhance security even further, we can ensure that no files or data are stored on our servers and never leave your country.
Learn more about security