HTML to PDF conversion API
Stop wasting time implementing and maintaining a third-party software/library.
With PDFShift, rely on an up-to-date, high-fidelity conversion API with no maintenance costs.
Rely on a leading conversion service.
Thousands of users trust us to quickly convert documents with a high-fidelity result
-
22+ Millions
Conversions made -
15,000+
Users that trusts us -
1.5s
Average conversion time -
99.99%
Uptime
Integrate PDFShift with just a simple request
We believe that developers should focus their time on things that matter, not setting up yet another PDF library. Because we eliminate needless complexity and provide an up-to-date service, you can get up and running with PDFShift in just a couple 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
Set custom headers and footers with pagination, inject custom CSS and javascript, encrypt your documents and many 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.
Privacy-focused
That's why your documents are not stored on our server (except when explicitly requested) and are not kept for more than 2 days.
They trust us.
More than 90 positives reviews can not lie, see for yourself:

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 customizeable, 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
and upgrade to the plan that best match your needs..
- 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 adjusts to your need with higher plan, from 25k credits (99$/m) to up to 1 Millions credits (1,000$/m).
Contact Our Sales Team
Our team is happy to answer your sales questions.
Fill out the form below and we will be in touch as soon as possible