Convert your files with our online file conversion API

The ConvertAPI provides online API for creating PDF and Images from various sources like Word document, web pages or raw HTML codes. In just few minutes you can integrate it into your application and use it easily. Return to APIs list.

Do you have file format which is not supported by our ConvertApi online service? Just contact us and we will add it for you.

  1. Convert web page to PDF API

    The API for converting web pages to PDF files. Fully supports HTML and CSS tags, including page breaks, JavaScript and other html elements. Set PDF options such as page size, orientation, margins.

    Rest Api .Net Library

REST API Documentation

An API call is made by sending an HTTP request with parameters passed as POST data to the Web2Pdf service API URI:

http://do.convertapi.com/Web2Pdf

Converted file is returned as HTTP response stream, additional data are available in HTTP response header. If API call is succeeded HTTP response status code will be 200 OK, if fail then 400 Bad Request.

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

Converted file and additional data are returned as JSon object. A file is encoded using Base64 encoding.

Below are properties supported by conversion api. The properties marked with "›" are write properties, they accepts values. The properties which has "‹" marker are read properties, they returns values.

Properties
NameTypeSummary
Authentication
ApiKey integer
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/control-panel
Conversion Parameters
Timeout = 300 integer
Conversion timeout in seconds. The minimum value is 5 seconds and maximum is 600 seconds (10 minutes)
CUrl 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.
ConversionDelay = 0 integer
Delay in seconds before page load and PDF creation. Sometimes usefull to let web page to load in full.
AuthUsername string
HTTP authentication username, used if conversion web page is protected with HTTP authentication.
AuthPassword string
HTTP Authentication password, used if conversion web page is protected with HTTP authentication.
Credits Information
CreditsLeft integer
Return number of remaining credits. Only available when ApiKey is provided.
CreditsCost = 1 integer
The cost of credits for one conversion.
Header and Footer
HeaderUrl string (url or html)
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 string
Left aligned header text.
HeaderTextCenter string
Center aligned header text.
HeaderTextRight string
Right aligned header text.
HeaderTextFont = Arial string
Set header font name.
HeaderTextSize = 12 integer
Set header font size.
HeaderLine = false boolean
Display line below the header.
HeaderSpacing = 0 string (unit)
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 string (url or html)
Adds a html footer. This can be either a URI or HTML code.
FooterTextLeft string
Left aligned footer text.
FooterTextCenter string
Center aligned footer text.
FooterTextRight string
Right aligned footer text.
FooterTextFont = Arial string
Set footer font name.
FooterTextSize = 12 integer
Set footer font size.
FooterLine = false boolean
Display line above the footer.
FooterSpacing = 0 string (unit)
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.
HTML Options
Scripts = true boolean
Allow web pages to run javascript.
Plugins = false boolean
Enable plugins such as flash.
Background = true boolean
Print web page background.
PrintType = false boolean
Use print media-type(print css sheet) instead of screen.
HTTP Request Headers
UserAgent string
Set custom user agent.
AcceptLanguage string
Set accept language header.
Output Result
Result boolean
Conversion result. Return True if conversion successful, otherwise False.
Error string
Contain information about conversion failure. Only available when Result = False.
FileSize integer
Converted file size in bytes.
StoreFile = false boolean
Store file on server and return url to file instead of file stream response. File will be available for 24 hours.
FileUrl string
Converted file url to download from a server. Only available when StoreFile = True.
File bytes
If JSon object is used as output then a file will be encoded using Base64 encoding.
OutputFileName string
Converted output file name. If parameter is not set the filename will be generated automatically.
Page Setup
PageOrientation = portrait string (collention)
portrait - Portrait page orientation
landscape - Landscape page orientation
PDF page orientation.
PageSize = a4 string (collention)
a0 - A0 (841 × 1189 mm, 8.26 × 11.69 inches)
a1 - A1 (594 × 841 mm, 23.4 × 33.1 inches)
a2 - A2 (420 × 594 mm, 16.5 × 23.4 inches)
a3 - A3 (298 × 420 mm, 11.7 × 16.5 inches)
a4 - A4 (210 × 298 mm, 8.3 × 11.7 inches)
a5 - A5 (148 × 210 mm, 5.8 × 8.3 inches)
a6 - A6 (105 × 148 mm, 4.1 × 5.8 inches)
a7 - A7 (74 × 105 mm, 2.9 × 4.1 inches)
a8 - A8 (52 × 74 mm, 2.0 × 2.9 inches)
a9 - A9 (37 × 52 mm, 1.5 × 2.0 inches)
b0 - B0 (1000 × 1414 mm, 39.4 × 55.7 inches)
b1 - B1 (707 × 1000 mm, 27.8 × 39.4 inches)
b2 - B2 (500 × 707 mm, 19.7 × 27.8 inches)
b3 - B3 (353 × 500 mm, 13.9 × 19.7 inches)
b4 - B4 (250 × 353 mm, 9.8 × 13.9 inches)
b5 - B5 (176 × 250 mm, 6.9 × 9.8 inches)
letter - Letter (216 × 279 mm, 8.5 × 11 inches)
legal - Legal (216 × 356 mm, 8.5 × 14 inches)
ledger - Ledger (432 × 279 mm, 17 × 11 inches)
PDF page paper sizes.
PageWidth string (unit)
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 string (unit)
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.
MarginLeft = 5 string (unit)
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 = 5 string (unit)
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 = 10 string (unit)
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 = 10 string (unit)
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.
PDF Options
DocumentTitle string
Set the title of the generated pdf file. If value is not set a html page title is used instead.
CoverUrl string (url or html)
Use html document as cover. It will be inserted before the toc with no headers and footers.
Outline = false boolean
Show outline in PDF file.
PageNo = false boolean
Show page number in footer.
InfoStamp = false boolean
Show date stamp and conversion url in header.
LowQuality = false boolean
Generates lower quality PDF, makes smaller file size.