ScriptCase is a web development platform built on PHP that helps you put together web apps really quickly with less code. Connect to your database of choice, and start generating graphs, reports, and anything else you need. ScriptCase is great because it allows you to generate PDFs out of your stored data. You can even have some flexibility in the layout of the PDF.
However, even with some of the customizations, it may not be enough. If you truly need a completely custom PDF output that is not supported by what ScriptCase offers out of the box, your only option is to write some raw PHP code. The only problem is, if you deploy your PHP application, trying to use a local installation of wkhtmltopdf or headless chrome may simply not be an option. This is where Api2Pdf comes in. You can write your PHP code to generate whatever custom HTML output you are looking for, and then send that to our API to convert that HTML to a PDF for you. Below, we will provide instructions on how to create a custom PHP file to connect to Api2Pdf in ScriptCase.
Log into your ScriptCase application and go to Tools > External Libraries. Click Create a new library. Make sure the library is public and give it a name: Api2Pdf
The new library should be listed. Click Use library. Then click Edit.
Click New file. Give the file a name, such as ‘api2pdf.php’. Click on the newly created file to edit it.
In your new file, copy and paste the code below and click Save.
Now create a blank PHP template in your application and use the following sample code below. Replace YOUR-API-KEY with your Api2Pdf.com API Key. If you need an API key, you can create one by signing up here.
Run your application to test it out and generate a PDF!Tags: html-to-pdf, pdf, pdf-generation, php, scriptcase
Comments are closed.