Convert HTML to PDF
without effort

Our API makes PDFs from webpages or HTML. Fast, easy and reliable!
Try it with any URL below or scroll down to the code examples.

How to use our HTML2PDF API

Below you'll find basic examples for all major programming languages.
With just a few lines of code you can convert any URL or HTML to PDF.
You can find all options and examples in our API documentation and the description of the click to PDF links.


// the following code converts the URL to PDF in PHP

$url = urlencode("");
$license = "yourlicensekey";
// now we call the HTML2PDF API
$pdf = file_get_contents("{$license}&url={$url}";

// the PDF is stored in the parameter $pdf now

// the following code converts the URL to PDF in C#/ .NET

string license = "yourlicensekey";
string url = System.Net.WebUtility.UrlEncode("");

using (var client = new WebClient())
    client.QueryString.Add("license", license);
    client.QueryString.Add("url", url);
    client.DownloadFile("", @"c:\temp\mypdf.pdf");

// the following code converts the URL to PDF in Java

String license = "yourlicensekey";
String url = URLEncoder.encode("",java.nio.charset.StandardCharsets.UTF_8.toString() );
File outs = new File("C:\\temp\mypdf.pdf");

URL u = new URL("" + license + "&url=" + url);
URLConnection uc = u.openConnection();
BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(outs));

byte[] b = new byte[8 * 1024];
int read = 0;
while ((read = > -1) {
	bout.write(b, 0, read);

// the following code converts the URL to PDF in Python

import urllib2

data = {
   'license': 'yourlicensekey',
   'url': ''
requesturl = '{license}&url={url}'.format(**data)
result = urllib2.urlopen(requesturl)
localFile = open('mypdf.pdf', 'w')

# the following code converts the URL to PDF in Ruby

require 'net/http'
license = 'yourlicensekey'
url = ''

uri = URI("{license}&url=#{url}")
Net::HTTP.start(, uri.port) do |http|
  request = uri.request_uri

  http.request request do |response|
    open 'mypdf.pdf', 'w' do |io|
      response.read_body do |chunk|
        io.write chunk

# the following code converts the URL to PDF in Perl

use File::Fetch;
use URI::Escape;

my $license = "yourlicensekey";
my $url = uri_escape("");

my $ff = File::Fetch->new(uri => "$license&url=$url");
my $where = $ff->fetch( to => '/tmp');

# The following cURL command converts the URL to a PDF with the name result.pdf

curl 	-d "license=yourlicensekey" \
	--data-urlencode "url=" \
	-o result.pdf \
	-H "Content-Type: application/x-www-form-urlencoded" \

# If you want to use HTML instead, then you can use the following cURL command to convert a file html.html with HTML to PDF

curl 	-d "license=yourlicensekey" \
	--data-urlencode html@html.html \
	-o result.pdf \
	-H "Content-Type: application/x-www-form-urlencoded" \

# The following Wget command converts the URL to a PDF with the name result.pdf

wget -O result.pdf --post-data="license=yourlicensekey&url="

<!-- If you want to add a Click to PDF link to your pages, then just add the following link -->

<a href="javascript:location.href=''+escape(location.href)">Click to PDF</a>

What will you get?

The easiest service to use with the best support!

Easy Integration

You can set all your conversion options in a WYSIWIG members area and use our API with just a few lines of code.

Many Layout Options

Custom page sizes, header, footer and many more easy to configure settings at your disposal.

High Quality Output

PDFs that look EXACTLY like what you see on the screen and that can be used in professional settings.

Great Support

We love what we do and have been doing it since 2008. We know what you need and are happy to help!

Long History

We have been around for a long time and thousands of customers trust and have trusted us. You can too!


99.9% Uptime and the latest technology in use. You can let us worry about delivering and maintaining!

What do our customers say?

We are running HTML2PDF since 2008 and hundreds of companies have trusted our service in the past.

" We're running this without fail for years now. Excellent! "

- Julien LaCoste

" Thanks for all your help. I appreciate how kind your support is!"

- SamHomeGauge

" Thanks for the great solution and the speedy support. You're a lifesaver!"

- MinBillTrust

Get a Free Trial

If you want to try our API first, then please feel free to get a free trial!