Convert Your HTML to PDF Fast, Easy and Safe
PDFShift delivers instant, high-quality website and HTML conversion to PDF via API.
Our up-to-date, high-fidelity integration works with Python, Node JS, PHP, Ruby and other common web programming.
Rely on leading conversion science.
Users all over the world trust PDFShift for high-quality document conversion.
-
30+ Million
Conversions made -
17,000+
Loyal users -
1.5s
Average conversion time -
99.99%
Uptime
Integrate PDFShift with one simple request
We believe that designers, developers and business owners should maximize efficiency instead of setting up countless PDF libraries. Our modern HTML to PDF solution removes complexity and allows setup and conversions in a matter of minutes.
const fetch = require('node-fetch')
fetch('https://api.pdfshift.io/v3/convert/pdf', {
method: 'POST',
headers: {
Authorization: 'Basic ' + Buffer.from('api:your_api_key').toString('base64'),
'Content-type': 'application/json'
},
body: JSON.stringify({
source: 'https://en.wikipedia.org/wiki/PDF',
landscape: false,
use_print: false
})
}).then(response => {
response.body.pipe(fs.createWriteStream('wikipedia.pdf'))
})
// You can also use Axios if you want:
// https://gist.github.com/cnicodeme/28ade69b269ca0a4af0a7c29c479b747
import requests
response = requests.post(
'https://api.pdfshift.io/v3/convert/pdf',
auth=('api', 'your_api_key'),
json={"source": "https://en.wikipedia.org/wiki/PDF", "landscape": False, "use_print": False}
)
response.raise_for_status()
with open('wikipedia.pdf', 'wb') as f:
f.write(response.content)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.pdfshift.io/v3/convert/pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(array("source" => "https://en.wikipedia.org/wiki/PDF", "landscape" => false, "use_print" => false)),
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
CURLOPT_USERPWD => 'api:your_api_key'
));
$response = curl_exec($curl);
file_put_contents('wikipedia.pdf', $response);
// We even made a GIST for you at:
// https://gist.github.com/cnicodeme/f2c73d89ac49313d023d738b5cdb7046
require 'uri'
require 'net/https'
require 'json' # for hash to_json conversion
uri = URI("https://api.pdfshift.io/v3/convert/pdf")
data = {"source" => "https://en.wikipedia.org/wiki/PDF"}
Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
request = Net::HTTP::Post.new(uri.request_uri)
request.body = data.to_json
request["Content-Type"] = "application/json"
request.basic_auth 'api', 'your_api_key'
response = http.request(request)
if response.code == '200'
# Since Ruby 1.9.1 only:
File.binwrite("wikipedia.pdf", response.body)
else
# Handle other codes here
puts "#{response.code} #{response.body}"
end
end
import java.io.File;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.time.Duration;
import org.json.JSONObject;
public class Application {
private static final String API_KEY = "api:your_api_key";
public static void main(String... args) throws Exception {
var jsonObject = new JSONObject();
jsonObject.put("source", "https://en.wikipedia.org/wiki/PDF");
var httpRequest = HttpRequest.newBuilder()
.uri(URI.create("https://api.pdfshift.io/v3/convert/pdf"))
.timeout(Duration.ofSeconds(20))
.header("Content-Type", "application/json")
.header("Authentication", "Basic " + API_KEY)
.POST(HttpRequest.BodyPublishers.ofString(jsonObject.toString()))
.build();
var httpClient = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.build();
var response = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofInputStream());
var statusCode = response.statusCode();
if (statusCode == 200 || statusCode == 201) {
// Save the file locally
var targetFile = new File("src/main/resources/wikipedia.pdf");
Files.copy(response.body(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} else {
// error occurred
}
}
}
using System;
using RestSharp;
using Newtonsoft.Json;
using System.IO;
using RestSharp.Authenticators;
using RestSharp.Serialization;
using System.Net.Mail;
using System.Net;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace PDFShiftExample
{
class Program
{
static void Main(string[] args)
{
IRestClient client = new RestClient("https://api.pdfshift.io/v3/convert/pdf");
client.Authenticator = new HttpBasicAuthenticator("api", "your_api_key");
IRestRequest request = new RestRequest(Method.POST);
var json = new
{
source = "https://en.wikipedia.org/wiki/PDF"
};
request.AddJsonBody(json);
IRestResponse response = client.Execute(request);
if (!response.IsSuccessful)
{
// Check why status is not int 2xx.
}
else
{
File.WriteAllBytes("wikipedia.pdf", response.RawBytes);
}
}
}
}
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
func main() {
API_KEY := "api:your_api_key"
message := map[string]interface{}{
"source": "https://en.wikipedia.org/wiki/PDF",
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
client := http.Client{}
request, err := http.NewRequest("POST", "https://api.pdfshift.io/v3/convert/pdf", bytes.NewBuffer(bytesRepresentation))
if err != nil {
log.Fatalln(err)
}
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Authorization", "Basic " + API_KEY)
resp, err := client.Do(request)
if err != nil {
log.Fatalln(err)
}
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
// write the response to file
ioutil.WriteFile("wikipedia.pdf", body, 0644)
} else {
// An error occurred
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
log.Println(result)
log.Println(result["data"])
}
}
curl \
-u 'api:your_api_key' \
-H 'Content-Type: application/json' \
-d '{"source":"https://en.wikipedia.org/wiki/PDF","landscape": false, "use_print": false}' \
"https://api.pdfshift.io/v3/convert/pdf" \
-o wikipedia.pdf
# That's all!
Features
Parallel conversions
Process multiple documents in parallel to increase conversion speed.
Asynchronous request
Use our powerful webhook system to be notified once a conversion is done.
Advanced Options
Customize headers and footers with pagination, inject custom CSS and javascript, encrypt your documents, and more.
Raw HTML support
No need to make your private page public. Simply send us your raw HTML data instead and we will convert it.
High-Fidelity PDF
Generate a high-fidelity document, close to your original HTML, in a few seconds.
Private & Secure
Your documents aren’t stored on our servers (unless you’d like them to be) and are removed within two days.
A trusted solution.
Hear from satisfied PDFShift users converting files from all over the world:

So far this is one of the best HTML to PDF converters I have come across. I like that it's simple and does a good job. Also, their support and pricing is great!
Stop rolling your own PDF generator - PDFShift has done it better.

Perfect rendering, easy to setup and use.

Very easy to use, highly customizable, and works just as intended. The biggest feature missing from other PDF APIs was the ability to decide where a page "breaks" and continues on to a new page. PDFShift made doing so easy with a simple CSS class.

PDFShift is awesome! Before I was creating PHP PDF files through fPDF and it was very time consuming and difficult. Now with PDFShift, I can just mock them up in HTML and CSS and then through a very simple and easy to use API I can create a PDF in a matter of seconds. I highly recommend PDFShift.
Pricing
- Monthly credits500
- Overage cost0.04$/conv
-
Dynamic file size limit
A credit is counted per 5Mb chunks.
For instance, a 15Mb PDF will use 3 credits.
- Monthly credits2,500
- Overage cost0.03$/conv
-
Dynamic file size limit
A credit is counted per 5Mb chunks.
For instance, a 15Mb PDF will use 3 credits.
- Monthly credits5,000
- Overage cost0.025$/conv
-
Dynamic file size limit
A credit is counted per 5Mb chunks.
For instance, a 15Mb PDF will use 3 credits.
Need More?
PDFShift can meet your needs with higher volume plans. Dontact us to ask for a dedicated plan.
Contact Us
We’re happy to help or answer any questions about PDFShift.
Please provide your information below and we will response as soon as possible.