The Document Conversion API

You send us HTML, we send back PDFs & XLS files.

How It Works

From your server…

DocRaptor works with whatever language you do. It’s just HTTP requests, after all!

  1. PHP<?php # run: composer install docraptor/docraptor $docraptor = new DocRaptor\DocApi(); $docraptor->getConfig()->setUsername("YOUR_API_KEY_HERE"); $doc = new DocRaptor\Doc(); $doc->setTest(true); $doc->setDocumentUrl("<%= doc_url %> "); $doc->setName("docraptor-php.<%= doc_type %>"); $doc->setDocumentType("<%= doc_type %>"); $create_response = $docraptor->createDoc($doc);
  2. Node// npm install restler var sys = require("util"), fs = require("fs"), rest = require("restler"), p = console.log; rest.postJson("", { user_credentials: "YOUR_API_KEY_HERE", doc: { document_url: "<%=doc_url%>", type: "<%=doc_type%>", test: true } }).on("success", function(data, response) { fs.writeFile("javascript_sample.<%=doc_type%>", response.raw, "binary", function(err){if(err) throw err;}); p("Success Creating Document"); p("Check out \"javascript_sample.<%=doc_type%>\" in this directory"); }).on("fail", function(data, response) { p("Failure Creating Document"); p(data); }).on("error", function(err, response) { p("Error Creating Document"); p(err); });
  3. Ruby# add to your Gemfile: gem "docraptor" # run bundle install require "docraptor" DocRaptor.configure do |dr| dr.username = "YOUR_API_KEY_HERE" end $docraptor = response = $docraptor.create_doc( test: true, document_url: "<%= doc_url %>", name: "docraptor-ruby.<%= doc_type %>", document_type: "<%= doc_type %>", )
  4. Python# run: pip install docraptor import docraptor doc_api = docraptor.DocApi() doc_api.api_client.configuration.username = "YOUR_API_KEY_HERE" response = doc_api.create_doc({ "test": True, "document_url": "<%= doc_url %>", "name": "docraptor-python.<%= doc_type %>", "document_type": "<%= doc_type %>", })
  5. Java// Add to pom.xml // <dependency> // <groupId>com.docraptor</groupId> // <artifactId>docraptor</artifactId> // <version>2.0.0</version> // </dependency> // // or get JARs from import*; import*; import com.docraptor.*; public class Sync { public static void main(String[] args) throws Exception { DocApi docraptor = new DocApi(); ApiClient client = docraptor.getApiClient(); client.setUsername("YOUR_API_KEY_HERE"); Doc doc = new Doc(); doc.setTest(true); doc.setDocumentUrl("<%= doc_url %>"); doc.setDocumentType(Doc.DocumentTypeEnum.<%= doc_type_upcase %>); doc.setName("docraptor-java.<%= doc_type %>"); docraptor.createDoc(doc); } }
  6. C Sharp// In the package manager console: // Install-Package DocRaptor // // or get DLLs from using DocRaptor.Client; using DocRaptor.Model; using DocRaptor.Api; using System.IO; class Example { static void Main(string[] args) { DocApi docraptor = new DocApi(); docraptor.Configuration.Username = "YOUR_API_KEY_HERE"; Doc doc = new Doc( test: true, documentUrl: "<%= doc_url %>", name: "docraptor-csharp.<%= doc_type %>", documentType: Doc.DocumentTypeEnum.<%= doc_type_capitalized %> ); byte[] createResponse = docraptor.CreateDoc(doc); } }
Screenshot of using curl to make an API request to DocRaptor

…you send html…

You can send HTML or just a URL, and we’ll do the rest. And because our world-class document conversion engine understands the latest HTML5, CSS3, and JavaScript, your documents will always look their best.

…and get back PDF or XLS files.

With PDF support for features like pagination, page numbers, tables of contents, and internal links, and XLS support for worksheets, styling, and formatting, you can make just about anything!

3 overlapping screenshots of actual documents output from the DocRaptor API: a multi-sheet xls file, a pdf invoice, and a PDF ebook with watermarks