Pdfcrowd Blog

Product updates, tips & tricks

In the previous installments of this series we showed how to use the Pdfcrowd API to convert web pages and HTML files to PDF using C and C++. Rust is considered a safe alternative to C and C++, so in this article we will show how to integrate the Pdfcrowd API into your Rust applications.

The code will use the reqwest Rust HTTP client library to make HTTP requests to the API. You can download complete sample code for quick integration into your project.

In the previous article in this series we showed how to use the Pdfcrowd API in C to convert web pages and HTML documents to PDF. While it is perfectly fine to use C code in a C++ application, C++ programmers may prefer to integrate the API using modern C++.

You can download the complete C++ code with examples for quick integration into your project.

In this article, we will show how to convert a webpage or an HTML document to PDF in C using the Pdfcrowd API.

We will show the convert() function that provides the conversion functionality. We will demonstrate how to use it to create PDF from various input sources, such as a URL, a local HTML file, or an HTML string. By the end of this article, you should have a good understanding of how to integrate the Pdfcrowd API into your C programs for HTML to PDF conversion.

The API is cloud-based and accessible over HTTP. We will use libcurl to communicate with the API. libcurl is a widely used library available on all major platforms.

To quickly incorporate the Pdfcrowd API into your own code, you can download the complete C code with examples.

This screencast will show you how to easily create a PDF document from a HTML file or a web page in PHP. You will also learn how to serve the PDF file from your PHP web application and download it in the browser.


The Pdfcrowd HTML to PDF API makes it easy to programmatically create fillable PDF forms from standard HTML forms. The API supports most of the HTML form features and, together with support for digital signatures (see Create Digital Signature in PDF), provides an easy way to create PDF forms.

This feature is available starting with Pdfcrowd API client libraries version 5.6.

Simple Example

Add an HTML form field, for example a text input:

<p>Enter name: <input type="text"></p>

Enable generation of fillable PDF forms with the setEnablePdfForms() method:


The resulting PDF will display an interactive input text field.

See: Example PDF, HTML and Code

A digital signature is a piece of information placed in a PDF document that makes it possible to verify the authenticity of the document. The Pdfcrowd API allows you to programmatically create PDFs containing a digital signature field. Such PDFs can be digitally signed in, for example, Adobe Reader or Preview.

This feature is available starting with Pdfcrowd API client libraries version 5.0.

Quick Start

To add a signature field to a document, set the pdfcrowd-signature class on a DIV element and specify its dimensions.

<div class="pdfcrowd-signature" 
     style="width: 2in; height: 1in; border: 1pt solid black;">

Our HTML to PDF API will transform this element to a signature field in the resulting PDF.

Postman is a platform for using APIs. You can use it to interact with the Pdfcrowd API and convert between PDF, HTML and various image formats.

Let's first configure the API endpoint and the credentials. This configuration is common for all conversion types.

API endpoint - Select the HTTP POST method and enter the API endpoint: https://api.pdfcrowd.com/convert/

Postman - Pdfcrowd API endpoint

API credentials. The authorization method is Basic Auth. You can use either the demo credentials or your personal API credentials.

In this tutorial you will learn how to add header and footer to PDF created by Pdfcrowd API. We will use PHP for illustrative purposes, but the code would be essentially the same in all languages the API supports.

Step-by-Step Example

Let's start with instantiating the Pdfcrowd client and setting the page format to Letter:

$client = new \Pdfcrowd\HtmlToPdfClient($user_name, $api_key);

The next step is to design our HTML footer and header. We can use special CSS classes that will be expanded as follows:

  • pdfcrowd-page-count - the total page count of printed pages
  • pdfcrowd-page-number - the current page number
  • pdfcrowd-source-url - the source URL of the main document


The Pdfcrowd API v2 is the new generation of our API. It is not 100% backward compatible but the changes are mostly syntactic and the migration from API v1 should be straightforward.

If you want to switch your current API v1 plan to API v2, please follow these steps:

  1. Activate the free API v2 trial in your account page.
  2. Follow the instructions below and migrate your API v1 implementation to API v2.
  3. If the API v2 works to your satisfaction, choose from our API v2 plans.
  4. If you no longer need the API v1 implementation, you can cancel the API v1 plan.

In this tutorial you will learn how to easily convert web pages and raw HTML documents to PDF in your PHP applications. We will use the Pdfcrowd API for PDF generation. The API offers these benefits:

  • The API is easy to use and fully supports HTML/CSS3/JavaScript.
  • The integration takes only a few minutes.
  • No third-party libraries are needed, just a single tiny PHP file.
  • It does not consume CPU/memory on your computer, PDFs are created on the Pdfcrowd servers.


Let's start with an example:

require 'pdfcrowd.php';

$client = new \Pdfcrowd\HtmlToPdfClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d");
$pdf = $client->convertUrl('https://en.wikipedia.org/');