DocRaptor Review – HTML to PDF API

Here’s a great article from The Crazy Programmer

Here, in this article, we’ll review the DocRaptor tool, an HTML to PDF API converter. The DocRaptor review will briefly discuss how it works with Python, some code examples, features, benefits, and perhaps pros and cons.

What is the DocRaptor Tool?

DocRaptor is an HTML to PDF and Excel format transforming document API. The tool uses a set of coding language for HTTP POST requests for the generation of PDF and XLS files. Besides, PDFs support the new HTML5, CSS3, and JavaScript conversions with the engine’s help from DocRaptor for various styles and formatting capabilities.

It is the best and easiest HTML-to-PDF API. Since the sole API powered with the PrinceXML HTML-to-PDF engine, the DocRaptor provides strong support for headers, page breaks, page numbers, flexbox, Water Marks, available PDFs, and a whole lot more.

What is the tool built using?

The API is built with web standards, enabling such a thing that works in a browser to work in DocRaptor, including HTML, CSS, XML, SVG, and JavaScript. The stage-manages any custom font available via the internet and can manage advanced typography styling like kerning, ligatures, or little caps. Support for higher-level designs allows users to add headers and footers, page numbers, footnotes along with cross-references, as well as tables, lists, columns, or even floats.

DocRaptor additionally supports features like pagination, table of contents (i.e., for a PDF eBook), internal links, and watermarking, in addition to XLS services such as worksheets, styling, and formatting. All documents could be secured using encryption, passwords, and metadata.

What needs the DocRaptor tool to work?

DocRaptor works together with any code terminology and comprises documentation with full coding examples for creating PDF and Excel files using C#, Curl, Java, JavaScript, jQuery, .NET, Node, PHP, Python, Rails, and Ruby. Moreover, wrappers and libraries are also accessible in several languages.

DocRaptor Features

Guaranteed Uptime

DocRaptor API provides a 99.999% uptime speed with high reliability and service, highly trusted in the market.

No Size Limit

The tools offer no limits on document input or output size, and all documents cost the same, regardless of their size.

Infinite Throughput

The DocRaptor tools’ infrastructure is crafted in a way that it can handle thousands of documents per second.

Simple Headers & Footers

Rather than adding PDF headers and footers using a different HTML document, DocRaptor headers and footers are a part of one’s record HTML. And readily show (or hide) different headers and footers for diverse pages.

Fine-Tune Page Breaks

The search engine of DocRaptor has been assembled and designed to make PDFs, and also it fully supports CSS3 Paged Media. This permits much more control over page breaks, and especially when coping with tables and graphics.

Blended Layouts & Sizes

Contrary to competitors, DocRaptor enables you to get a handle on both the style, layout, and sizing styles of pages on your own record. Along with picking webpages, you can also style right and left pages otherwise, or even perhaps the very first and last pages.

CSS Flexbox

DocRaptor enables you to create PDFs with complex CSS design tools, for example, flexbox. You won’t need to know new tools or dramatically fix your site to find yourself a nice looking PDF.

Tagged PDFs

Create more accessible PDFs using PDF profiles PDF/A-1a, PDF/A-3a, or PDF/UA-1. Tagged PDFs Boost the scanning experience for assistive technology like screen readers.

HTML-to-PDF with Python using DocRaptor

Converting HTML, CSS, and JavaScript into PDF and XLS documents with Python is fast and painless with DocRaptor. Moreover, together with DocRaptor, you can make your document look perfect by using the tools’ API reference and style and formatting guide.

For making records, below are working Python examples.

Installation:

pip install –upgrade docraptor

or

easy_install –upgrade docraptor

Note: If you are on a system with easy_install but not pip, you can use easy_install instead. If you’re not using virtualenv, you may have to prefix those commands with sudo.

Below given is a barebones example with more robust file output and error handling, hosted documents, asynchronous generation, and asynchronous hosted documents.

import docraptor

doc_api = docraptor.DocApi()
doc_api.api_client.configuration.username = 'YOUR_API_KEY_HERE'
# doc_api.api_client.configuration.debug = True

response = doc_api.create_doc({
  "test": True,                                                   # test documents are free but watermarked
  "document_content": "<html><body>Hello World</body></html>",    # supply content directly
  # "document_url": "http://docraptor.com/examples/invoice.html", # or use a url
  "name": "docraptor-python.pdf",                                 # help you find a document later
  "document_type": "pdf",                                         # pdf or xls or xlsx
  # "javascript": True,                                           # enable JavaScript processing
  # "prince_options": {
  #   "media": "screen",                                          # use screen styles instead of print styles
  #   "baseurl": "http://hello.com",                              # pretend URL when using document_content
  # },
})

Synchronously generated documents as above are limited to 60 seconds of generation time. However, up to 10 minutes are possible via the asynchronous process.

Creating a Custom Template

Now we will continue to encode a template from scratch, but what if DocRaptor already has templates for your generation journey which you can modify rapidly?

Okay, let’s try DocRaptor tool itself for creating a custom template.

https://gist.github.com/yasoob/b3fbdfef05e3e12d24c9d73985c41646

It is the code for DocRaptor ‘s Website Receipt Template.

Now, if we want to customize the template speculating Python:

https://gist.github.com/yasoob/ff6d9681081bfb7f7dc6862f9a3a5c91

The badge, header, footer and table data have been customized, and the ‘Payout’ stamp below the number is applied. Just had to change the template minimally and now we have a very lovely receipt template that can be used to create pdfs.

Note: This is not a custom template created by myself. I’ve taken an example from the online source and applied it personally to help other mates like you.

Now, run the Python code again but this time, change the:

“test”: True

or

“test”: False

If it works, you will finally end up with a similar PDF as below:

DocRaptor Review

DocRaptor Benefits

Document Retention Settings

Documents can be extracted and restored directly after a generation or kept longer, so their support staff can support the implementation of debugging and design.

EU Standard & Certification

DocRaptor team fully endorse GDPR, Privacy Shield and other EU requirements for hundreds of European clients.

Free Test Documents

Every account includes unlimited watermarked test documents for easier setup, styling, and testing.

Encrypted at Rest

When not used for conversion systems, all record input and output are encrypted. DocRaptor is committed to keeping the details private.

Code Examples & Libraries

The tool houses libraries and code examples in every major language, including C#, Java, JavaScript, jQuery, .NET, Node, PHP, Python, Rails, Ruby, and more.

The Final Takeaway

When you create loads of PDF files on the fly without using much of your own machine tools, it is when the DocRaptor too is very useful.

Furthermore, as a cloud-based API, the platform provides technical support, rapid scalability and stability assurances for these libraries and their resources without the risk of long-term maintenance.

However, if you find this article useful, then share it with your mates. Besides, if you any related queries, then please let us know in the comment box below.

 

The post DocRaptor Review – HTML to PDF API appeared first on The Crazy Programmer.

Source link