Pdfcrowd Blog

Product updates, tips & tricks

Pdfcrowd website has been restructured. Main changes:

API clients have been updated to version 5.2.2 and WordPress plugins to version 2.6.2 to reflect the changes in the API reference.

We have released a new version of our Save as PDF and Save as Image WordPress plugins.

New:

  • Added the "URL Lookup" option to select how to retrieve URLs for Conversion Mode-URL.
  • Added the "Diagnostics" option that displays useful info about the button settings.

Changed:

  • Minor text update in the plugin settings.

Fixed:

  • Minor fix in the plugin settings.

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);
$client->setPageSize('Letter');

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

We have released a new version of our Save as PDF and Save as Image WordPress plugins.

New:

  • Added the "Indicator Timeout" option to set the maximum time the progress indicator is displayed. 

Changed:

  • The "HTTP Auth User Name", "HTTP Auth Password", "Cookies", "Fail On Main URL Error" and "Fail On Any URL Error" options are taken into account in the Upload conversion mode.
  • Minor source code optimization.

Fixed:

  • Fixed saving of the plugin options.
  • Minor fix of the progress indicator.