Generate PDFs from Salesforce Apex

February 5th, 2019 / by api2pdf /

We released the full code and documentation on GitHub.  See full details on how to generate PDFs using Salesforce.

Many developers moving to Salesforce are used to the power of .NET or Java and have their favorite way of generating PDFs from HTML.  Api2Pdf is a wrapper for wkhtmltopdf, Headless Chrome, and LibreOffice and proudly runs on AWS Lambda to allow for extremely low cost PDF conversions with no rate limits or file size limits. You can also generate bar codes and qr codes using ZXING.

In addition to our github code we have created an open source, unmanaged package, to allow you to quickly add the Api2Pdf libraries into your application.  In one click you can install all of the necessary apex codes and test pages to jump start any project you might be working on.

  1. Read the full install steps here
  2. Install the unmanaged package
  3. Add / modify the code to suit the needs of your custom app
  4. Include the api2pdf library in any managed package you wish to redistribute, this is an open source MIT licensed package

Once you have the library installed, the library is as easy to use as:

Api2PdfClient a2pClient = new Api2PdfClient("your-api-key");
Api2PdfResponse response = a2pClient.headlessChromeFromHtml('<p>test</p>', true, 'test.pdf');
String pdfUrl = response.getPdf();
Tags: , , , , , , , , , , , , , , , , , , , , , ,

Comments are closed.