Web2Pdf REST API

The API for converting Web Pages to PDF files.

Sign In

Endpoints

POST http://do.convertapi.com/Web2Pdf

Authentication Parameters

Parameter Description Value
ApiKey

Required

Number

API Key should be passed if you purchased membership with credits. Please login to your control panel to find out your API Key http://www.convertapi.com/a

Input Parameters

Parameter Description Value
CUrl

Required

String

URI of a web page to convert. Must start with http:// or https://. Several URI of web pages merged with %20 (space) symbol can be passed to create one PDF. For example if http://www.google.com%20http://www.nytimes.com URI will be passed the two web pages will be merged into one PDF. If URI has special characters like ? or & they must be encoded. Also a HTML code can be submitted for conversion using this parameter.

Parameters

Parameter Description Value
DocumentTitle

Optional

String

Set the title of the generated pdf file. If value is not set a html page title is used instead.

HeaderUrl

Optional

String

Adds a html header. This can be either a URI or HTML code. This and others header and footer properties support these smart tags. [page] - Replaced by the number of the pages currently being printed. [frompage] - Replaced by the number of the first page to be printed. [topage] - Replaced by the number of the last page to be printed. [webpage] - Replaced by the URL of the page being printed. [section] - Replaced by the name of the current section. [subsection] - Replaced by the name of the current subsection. [date] - Replaced by the current date in system local format. [time] - Replaced by the current time in system local format.

HeaderTextLeft

Optional

String

Left aligned header text.

HeaderTextCenter

Optional

String

Center aligned header text.

HeaderTextRight

Optional

String

Right aligned header text.

HeaderTextFont

Optional

String

Set header font name.

HeaderTextSize

Optional

Number

Set header font size.

HeaderLine

Optional

Boolean

Display line below the header.

HeaderSpacing

Optional

String

Spacing between header and content. Header spacing can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

FooterUrl

Optional

String

Adds a html footer. This can be either a URI or HTML code.

FooterTextLeft

Optional

String

Left aligned footer text.

FooterTextCenter

Optional

String

Center aligned footer text.

FooterTextRight

Optional

String

Right aligned footer text.

FooterTextFont

Optional

String

Set footer font name.

FooterTextSize

Optional

Number

Set footer font size.

FooterLine

Optional

Boolean

Display line above the footer.

Example: false

FooterSpacing

Optional

String

Spacing between footer and content. Header spacing can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

PageOrientation

Optional

String

PDF page orientation: portrait, landscape

PageSize

Optional

String

PDF page paper sizes.: a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, letter, legal, ledger

Example: a4

PageWidth

Optional

String

Custom page width. Custom page size can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed. This option override PageSize option.

PageHeight

Optional

String

Custom page height. Custom page size can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed. This option override PageSize option.

CoverUrl

Optional

String

Use html document as cover. It will be inserted before the toc with no headers and footers.

Outline

Optional

Boolean

Show outline in PDF file.

Example: false

Background

Optional

Boolean

Print web page background.

Example: true

PageNo

Optional

Boolean

Show page number in footer.

Example: false

InfoStamp

Optional

Boolean

Show date stamp and conversion url in header.

Example: false

MarginLeft

Optional

String

Set the page left margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

MarginRight

Optional

String

Set the page right margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

MarginTop

Optional

String

Set the page top margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

MarginBottom

Optional

String

Set the page bottom margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.

LowQuality

Optional

Boolean

Generates lower quality PDF, makes smaller file size.

Example: false

PrintType

Optional

Boolean

Use print media-type(print css sheet) instead of screen.

Example: false

Scripts

Optional

Boolean

Allow web pages to run javascript.

Example: true

Plugins

Optional

Boolean

Enable plugins such as flash.

Example: false

ConversionDelay

Optional

Number

Delay in seconds before page load and PDF creation. Sometimes usefull to let web page to load in full.

AuthUsername

Optional

String

HTTP authentication username, used if conversion web page is protected with HTTP authentication.

AuthPassword

Optional

String

HTTP Authentication password, used if conversion web page is protected with HTTP authentication.

UserAgent

Optional

String

Set custom user agent.

AcceptLanguage

Optional

String

Set accept language header.

AlternativeParser

Optional

Boolean

Set alternative parser. You should test both parsers and choose which to use depending on conversion quality.

Example: false

StoreFile

Optional

Boolean

Store file on server and return url to file instead of file stream response. File will be available for 24 hours.

Example: false

Timeout

Optional

Number

Conversion timeout in seconds. The minimum value is 5 seconds and maximum is 600 seconds

Example: 300

Output Headers

Output Response