2 Easy Steps to Convert Any Web Page Into a PDF File

Are you looking for a way that will allow you to quickly create a PDF version of any web page?
Our free online tool allows you to easily convert any web page to a PDF document.


Step 1: Copy the URL from the address bar and paste into the box below

Step 2: Click "Convert to PDF" and the converted file will be instantly downloaded to your device

Automate your HTML to PDF conversion using our FREE API key.

Our Free Plan has 200 credits/month with 5 Mb per PDF file.

Large PDF files use 1 credit per 500kb of network traffic.

Now used commercially by 10,500+ companies! We've grown too big to be a completely free service - read the backstory.

Code examples available for asp.net, jquery/javascript, php, java, android and others

Conversions are done on multiple server clusters spread across different datacenters

How to convert an html string or save a url or webpage to PDF

    • ASP.NET / C#

    • string apiKey = "ABCD-1234";
      string value = "http://www.google.com"; // a url starting with http or an HTML string.  See php example #5 if you are using long strings  
      using (var client = new WebClient())
                                                      client.QueryString.Add("apikey", apiKey);
                                                      client.QueryString.Add("value", value);
                                                      client.DownloadFile("https://api.html2pdfrocket.com/pdf/", @"c:\temp\mypdf.pdf");
      string apiKey = "ABCD-1234";
      string value = "http://www.google.com"; // a url starting with http or an HTML string
      using (var client = new WebClient())
          NameValueCollection options = new NameValueCollection();
          options.Add("apikey", apiKey);
          options.Add("value", value);
          ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;  //needed for older .net versions
                                          byte[] result = client.UploadValues("https://api.html2pdfrocket.com/pdf", options);
          System.IO.File.WriteAllBytes(Server.MapPath(Path.Combine("~/", @"c:\temp\mypdf.pdf")), result);
    • See more ASP.NET / C# examples including MVC..

    • HTML

    • <a href="https://api.html2pdfrocket.com/pdf?value=http://www.google.com&apikey=ABCD-1234">Download PDF</a>
    • See more javascript examples

    • PHP

    • $apikey = 'ABCD-1234';
      $value = 'http://www.google.com'; // a url starting with http or an HTML string (1600 byte limit).  see example #5 if you have a long HTML string
      $result = file_get_contents("https://api.html2pdfrocket.com/pdf?apikey=" . urlencode($apikey) . "&value=" . urlencode($value));
    • See more PHP examples including streaming to the browser..

    • Java

    • We've just added a Java example! Please check it out here

    • Android

    • We've just added an Android example! Please check it out here

    • RUBY

    • require 'net/http'
      apikey = 'ABCD-1234'
      value = 'http://www.google.com'   # a url starting with http or an HTML string
      uri = URI("https://api.html2pdfrocket.com/pdf?apikey=#{apikey}&value=#{value}")
      Net::HTTP.start(uri.host, uri.port) do |http|
           request = Net::HTTP::Get.new uri.request_uri
           http.request request do |response|
                                          open 'mypdf.pdf', 'w' do |io|
                 response.read_body do |chunk|
                 io.write chunk
    • Batch/Asynchronous Process

    • For PDF conversion taking more than 30 seconds or input/output files more than 6 Mb, you need to use the batch/asynchronous parameters. Examples: C#, PHP

    • Batch
      true to send it through batch process. API will return a PdfToken that you could use for your next api call.
    • PdfToken
      Token to retrieve the pdf file that was passed in batch process. You will get a PdfLink as a return.
    • Webhook
      Instead of polling if the pdf file is already ready, you can send a webhook url where we could post once the file is ready.
    • PdfDownloadExpirySeconds
      Number of seconds before the PdfLink expires. Default and minimum is 300 seconds, max is 900 seconds.
    • Page Breaks

    • <!DOCTYPE html>
                      .page {
                      padding: 100px;
                      @media screen {
                      .page {
                      page-break-before: always !important;
                      <div class="page">
                      <div style="height: 20px; background-color: #f91">Page 1</div>
                      <div class="page">
                      <div style="height: 20px; background-color: #000">Page 2</div>
Example Webpages Converted

Get Started

Don't waste your day reinventing the wheel, be converting in 3 minutes from now

Please help us by spreading the word