PDF to PDF in PHP

This page describes how to use the Pdfcrowd online API to join multiple PDF files or update PDF attributes in PHP. The API is user-friendly and can be integrated into your application with just a few lines of code.

Installation

Download pdfcrowd-5.17.0-php.zip, unzip it and require pdfcrowd.php in your code.

Check out other installation options such as Composer or GitHub.

Quick Start

Here are PHP examples for quickly getting started with the API. See more examples.

Authentication

The credentials to access the API are your Pdfcrowd username and the API key. You can try out the API without registering using the following demo credentials:

  • Username: demo
  • API key: ce544b6ea52a5621fb9d55f8b542d14d

To get your personal API credentials, you can start a free API trial or buy the API license.

Error Handling

It is recommended that you implement error handling to catch errors that the API may return, see the example code below. A list of status codes and their description can be found here.

try 
{
    // call the API 
}
catch(\Pdfcrowd\Error $why) 
{
    // print the error
    error_log("Pdfcrowd Error: {$why}\n");

    // print the error code
    error_log("Pdfcrowd Error Code: {$why->getCode()}\n");

    // print the error message
    error_log("Pdfcrowd Error Message: {$why->getMessage()}\n");
}

Troubleshooting

  • Refer to the API Status Codes page if the API returns an error.
  • You can use setDebugLog and getDebugLogUrl to get detailed info about the conversion, such as load errors, load times, browser console output, etc.
  • Check the FAQ.
  • Contact us if you need help or are missing a feature.

API Method Reference

Refer to the PDF to PDF PHP Reference for a description of all API methods.