Web2Pdf

FREE
By convertapi
Updated 4 months ago
Data
-/10
Popularity Score
-
Latency
-
Success Rate

Web2Pdf API Documentation

The API for converting web pages to PDF files. Fully supports HTML and CSS tags, including page breaks, JavaScript and other html elements.

View API Details
POSTConvert Url
POSTConvert Url JSon
POSTConvert Url

Post url to server

Authorization:

Authentication for the ConvertApi

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
CUrlSTRING
REQUIREDURI 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.
ApiKeyQUERY
REQUIREDGet your own free apikey on http://www.convertapi.com/prices
Optional Parameters
BackgroundBOOLEAN
OPTIONALPrint web page background.
ConversionDelaySTRING
OPTIONALDelay in seconds before page load and Pdf creation. Sometimes useful to let web page to load in full.
ScriptsBOOLEAN
OPTIONALAllow web pages to run javascript.
PrintTypeBOOLEAN
OPTIONALUse print media-type(print css sheet) instead of screen.
MarginLeftSTRING
OPTIONALSet the page left margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.
PageSizeSTRING
OPTIONALSet Pdf page paper sizes: a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, letter, legal, ledger.
MarginRightSTRING
OPTIONALSet the page right margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.
MarginBottomSTRING
OPTIONALSet the page bottom margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.
PageOrientationSTRING
OPTIONALSet Pdf page orientation: portrait or landscape.
MarginTopSTRING
OPTIONALSet the page top margin. Margins can be specified in millimeters (mm), inches (in) or centimeters (cm). If no units are specified, millimeters are assumed.
PageHeightSTRING
OPTIONALCustom 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 parameter.
PageWidthSTRING
OPTIONALCustom 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 parameter.
Code Snippet
unirest.post("https://convertapi-web2pdf.p.rapidapi.com/")
.header("X-RapidAPI-Host", "convertapi-web2pdf.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("Background=false")
.send("ConversionDelay=2")
.send("Scripts=false")
.send("MarginLeft=5")
.send("PageSize=a4")
.send("MarginRight=5")
.send("MarginBottom=10")
.send("PageOrientation=portrait")
.send("MarginTop=10")
.send("CUrl=http://www.google.com")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://convertapi-web2pdf.p.rapidapi.com/
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://convertapi-web2pdf.p.rapidapi.com/")
.header("X-RapidAPI-Host", "convertapi-web2pdf.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("Background=false")
.send("ConversionDelay=2")
.send("Scripts=false")
.send("MarginLeft=5")
.send("PageSize=a4")
.send("MarginRight=5")
.send("MarginBottom=10")
.send("PageOrientation=portrait")
.send("MarginTop=10")
.send("CUrl=http://www.google.com")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication