05. How PMB Pro Print Works

This article gives an overview of what technologies are involved in producing a PDF with PMB Pro Print.

When making a Pro PDF, the following happens:

  1. The user writes their content in WordPress. This saves “posts” and “postmeta” to the site’s database.
  2. When the user clicks to generate the project, PMB fetches all its posts and uses the project’s design to create an HTML file on the server, called the “Print Page”. This process is quite similar to how WordPress renders a page (using “the loop” and template files, etc.).
  3. The user visits the Print Page in their web browser, which lets the HTML file execute its Javascript, which can modify the HTML.
  4. Prince converts the HTML and CSS to a PDF

This means:

  • The content for each post’s body comes from WordPress. If there’s a problem with it, it may be a problem with WordPress’ editor or the other plugins you’re using to create the post content. On the Print Preview page, feel free to use your web browser’s inspector to look for problem in the HTML that was converted to PDF.
  • The content outside of the post’s body came from Print My Blog and your chosen design. So if the content outside of a post’s body needs adjusting, it’s probably an issue with Print My Blog, so please ask for help.
  • Javascript is executed as normal by your browser, so if there’s a problem with the Javascript not working correctly, that’s a problem happening when your browser opens the Print Page, just like on the frontend of your website. So you can use your browser’s debugger to look at the Javascript that’s executing to look for problems. The most likely problem is that a plugin’s Javascript somehow didn’t get enqueued on the Print Page. If that’s the case, please ask for help so we can fix the issue for you and others.
  • Because Prince is what interprets the CSS, if something isn’t styled properly in your PDF it’s probably because Prince is interpreting the CSS differently than your browser does. So it helps to have become familiar with Prince CSS.

If you have any questions about how or why something isn’t working as expected, please ask for help. Your asking questions helps me to improve the software and documentation and avoid problems for future users.