How to Create a PDF from FileMaker Server
Have you ever wanted to email customers their invoices automatically? Have you ever wanted to generate and email a report to your employees every morning? Have you ever just wanted to create a PDF from FileMaker Server? If you have answered yes to any of these questions, congratulations, you have come to the right place! Currently FileMaker Server does not support the creation of PDFs natively; however, if you have PHP enabled for your database, you can create a PDF from the server.
What Is Needed
First, you will need to download a PHP library that will allow you to create a PDF using PHP. I recommend using the Free PDF library as this article will assume you are using the FPDF library. Once you have downloaded FPDF and placed it within your web server, you will then need to create your report using PHP and the FPDF library.
Creating The PDF Using PHP
The next step is to write the PHP script that will create the PDF and output it back to FileMaker as a PDF. Because PHP is creating the entire PDF, all the business logic to create the report will need to be within PHP. You will need to use Custom Web Publishing to bring in any data that you may want within the report that is in your FileMaker database.
As you gather your data from FileMaker, you will build your PDF by setting the X and Y coordinates and the font of each object in the PDF. Check out the FPDF tutorial page for a quick tutorial on building PDFs with PHP to get a better understanding on how to use this library to its full potential. Once you are finished building the report, you will use the FPDF Output() function to output the PDF as a file back to FileMaker.
Saving The PDF From Server
The final step is to write a server-side script in FileMaker that will run the report. Use the Insert from URL script step to call the PHP script. The URL needs to be the web address of the PHP script. The Insert from URL script step will enter the content of your PHP file, which is a PDF, into a specified container field. Now you have everything you need in order to create a PDF using FileMaker Server.
Using PHP to build a PDF is a great way to automatically create and email PDFs from FileMaker Server. Feel free to download our example FileMaker database and PHP files and watch our YouTube video tutorial above so you can try this technique yourself. Or contact us and we would be happy to assist anyone looking to create PDFs from their FileMaker Server.
Download PDF from FileMaker Server Database
Please complete the form below to download your FREE FileMaker database file.
Did you know we are an authorized reseller for FileMaker Licensing?
Contact us to discuss upgrading your FileMaker software.