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 $configuration = DocRaptor\Configuration::getDefaultConfiguration(); $configuration->setUsername("YOUR_API_KEY_HERE"); $docraptor = new DocRaptor\DocApi(); $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 docraptor.configuration.username = "YOUR_API_KEY_HERE" # docraptor.configuration.debug = True doc_api = docraptor.DocApi() 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>1.1.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) { Configuration.Username = "YOUR_API_KEY_HERE"; DocApi docraptor = new DocApi(); Doc doc = new Doc( Test: true, DocumentUrl: "<%= doc_url %>", Name: "docraptor-csharp.<%= doc_type %>", DocumentType: Doc.DocumentTypeEnum.<%= doc_type_capitalized %> ); byte[] create_response = 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