CampSoftware is made up of a fantastic team of people who loves developing Apps to solve problems.
Phone: 407-282-5585
Our blog posts in your email:

Stacks Image 1027
HTMLPDFer is an open source Xojo Web App that converts HTML to PDF via a simple API.

Creating PDF reports with many different sections in a single document can be a major project in itself. You might need to learn to place text and images by drawing at specific coordinates, worry about drawing beyond the page width, and worry about page breaks.

HTMLPDFer make it simple by letting you create your reports in HTML. HTML reports are a bit like spilling coffee on a dish. The liquid will fill the shape of the dish until it spills over. Just like the coffee, the HTML content will fill the shape of the browser, but instead of spilling over, the content will just become scrollable based on the browser width.

Page breaks are handled by adding the CSS "page-break-inside: avoid !important;" to specific HTML tags that should be kept on the same page. In the demo, we use the following CSS in the HTML style which asks wkHTMLtoPDF to do its best to not split html found within section tags and table rows.

section, tr {
page-break-inside: avoid !important;

This works as long as each section and table row is a fraction of the page length. Looking at the demo, notice how each section is short. Short sections allow for minimal blank areas at the bottom of each page.

Three Demos are included, found in the htdocs folder:
  • Header and Footer with Base64 Header Image
  • Text Header and Footer
  • No Header

Here's an example conversion we ran recently:
htmlpdfer-demo.htm converted into htmlpdfer-demo.pdf

This is the same html, but watch how the pasted css changes the look of the table:
Stacks Image 3996

How does HTMLPDFer work?
HTMLPDFer is a Xojo App that uses the Aloe Express Web Server Module, and wkHTMLtoPDF terminal command for the actual conversion.

  • Xojo is our favorite development platform that provides the power to create Mac, Windows, Linux, iOS, Android (soon), and Web Apps.
  • Aloe Express is a powerful, easy-to-use, open source Xojo Web server module. Build APIs, microservices, Web sites, and more.
  • wkHTMLtoPDF is a command line tool to render HTML into PDF and various image formats using the Qt WebKit rendering engine.

When you run the HTMLPDFer Xojo project, it builds and runs a Xojo App that runs as a Console app using the Aloe Express Web server module. The Web server waits for requests. When a request arrives, it is validated, converted, and a PDF is returned.


HTMLPDFer in Browser
  • Run the HTMLPDFer Xojo project.
  • Load in your browser, but it should automatically launch.
  • Click the 'Convert HTML to PDF' button.
  • Edit the Params and the HTML and see how the PDF changes after Converting.

HTMLPDFer in FileMaker
  • Run the HTMLPDFer Xojo project.
  • Open the HTMLPDFer.fmp12 FileMaker file.

Download - Free and Open Source!

Questions and Answers

Q: Can you add a feature for me?
A: That depends on what you need! :) Seriously, just ask and we'll try!