Loading…
Generate PDF's from any URL

Docs

API Keys are used to authenticate each request you make to our server. Using this key we record the conversion attempt and results making sure not to count failed conversions from our side as successful conversions.

We provide each user with two API Keys, one for testing and one for live deployments. Please note using the test key will not occur usage but does download all PDF's with a watermark.


Connecting to our APi couldn’t be easier. See below for examples written in different languages. Using a simple CURL request and passing an array of attributes, the server will return the PDF data for you to manipulate or download however you wish.

The last 5 lines of this curl request will download the returned data into a PDF format.


$api_key = ' PLACE YOUR API KEY HERE ';
$url2pdf_url = 'https://url2pdf/api/';
$url = 'https://google.co.uk';

$data = array(
    "api_key"				=> $api_key,
    "url"               		=> $url,
    "pageWidth"         		=> "",
    "pageHeight"        		=> "",
    "scale"             		=> "1",
    "printBackground"   		=> "true",
    "landscape"         		=> "false",
    "pageRanges"        		=> "",
    "pageFormat"        		=> "A4",
    "pageMarginTop"     		=> "0mm",
    "pageMarginRight"   		=> "0mm",
    "pageMarginBottom"  		=> "0mm",
    "pageMarginLeft"    		=> "0mm",
    "preferCSSPageSize" 		=> "false",
    "customWatermark" 			=> "true",
    "customWatermarkText" 		=> "Here is my watermark...",
    "customWatermarkPlacement" 	=> "position: fixed; bottom: 15px; right: 15px; background: #1b95cf; z-index: 10000;padding:15px;border-radius:4px;opacity:0.95;color:#ffffff;"
);

$data_string = json_encode($data);
$ch = curl_init( $url2pdf_url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
header('Cache-Control: public'); 
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="Example PDF - URL2PDF.pdf"');
header('Content-Length: '.strlen($response));
echo($response);
	

api_key
Use one of the two (live/testing) api keys found within your account settings page.

customWatermark (true / false)
Embed a watermark. Default is false.

customWatermarkText
The text (content) of the watermark.

customWatermarkPlacement
Define the placement and style of the watermark using css styling.

printBackground (true / false)
Print background graphics. Default is false.

pageFormat
Paper format. If set, takes priority over width or height options. Defaults to 'Letter'.

pageHeight
Paper height, best used with defined units, defaults to millimeter.

landscape (true / false)
Paper orientation. Default is false.

pageMarginTop
Top margin, best used with defined units, defaults to millimeter. Empty value defaults to none.

pageMarginRight
Right margin, best used with defined units, defaults to millimeter. Empty value defaults to none.

pageMarginBottom
Bottom margin, best used with defined units, defaults to millimeter. Empty value defaults to none.

pageMarginLeft
Left margin, best used with defined units, defaults to millimeter. Empty value defaults to none.

preferCSSPageSize (true / false)
Give any CSS @page size declared in the page priority over what is declared in width and height or format options. Defaults to false, which will scale the content to fit the paper size.

pageRanges
Paper ranges to print, e.g '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.

scale
Scale of the webpage render. Default is 1. Scale values must be within the range of 0.1 to 2.

pageWidth
Paper width, best used with defined units, defaults to millimeter.

url
Defines the URL you wish to convert.

url2pdf_url
Defines the URL endpoint for the URL2PDF server.


Units:

px

pixel

in

inch

cm

centimeter

mm

millimeter

Format options:

Letter

8.5in x 11in

Legal

8.5in x 14in

Tabloid

11in x 17in

Ledger

17in x 11in

A0

33.1in x 46.8in

A1

23.4in x 33.1in

A2

16.54in x 23.4in

A3

11.7in x 16.54in

A4

8.27in x 11.7in

A5

5.83in x 8.27in

A6

4.13in x 5.83in


Exact Colours:
By default, url2pdf generates a pdf with modified colours for printing. Use the -webkit-print-color-adjust property to force rendering of exact colours.


CSS Media Print:
By using the 'preferCSSPageSize' set to true you can tell our server to listen and use the provided Media Print rules set within the pages you wish to convert.


@media print {
    .print-button {
        display: none;
    }
    
    .content div {
        break-after: always;
    }
}
	
	

Change Log

Server Upgrade
(Tue 13th Feb 2020)
Maintenance on the servers have been completed and we can announce we have upgraded to 4CPU and 12GBP ram for much quicker PDF generations. We have also introduce load balancing to help with traffic and speed of the PDF generations.

Balance Details
(Tue 13th Feb 2020)
We have fixed the bug that was showing the incorrect Next Invoice date, and current cost per PDF generation.

History Statistics
(Tue 13th Feb 2020)
The history statistics have now been updated and fixed to show for the current / correct month selected.

Design
(Mon 12th Feb 2020)
We have address some design and styling issues across the whole platform fo better UI & UX interaction.

Payment Gateway Bug
(Tue 20th Aug 2019)
We implemented a fix to the payment gateway that prevented users from upgrading to real time billing.