Note: This plugin was initially developed for our WatuPRO customers (more info here) but it’s not limited to a specific plugin. So we are releasing it to other developers.
What Does the PDF Bridge Do?
This plugin lets you apply WordPress filter to any piece of content and convert it to PDF. Simple as that. Depending on the version you download it uses the html2fpdf library or the MPDF library.
How To Use It In Your Plugin Or Theme?
The plugin is super simple (you could very well write it yourself) and adds a filter that can be used from your plugin or theme. The filter name is “pdf-bridge-convert” and all you need to do it, is to apply it to your HTML content. Then don’t forget to output PDF headers when sending the content to the user. Here is an example assuming you have your HTML in $content:
$content = apply_filters("pdf-bridge-convert", $content); header('Content-Length: '.strlen($content)); header('Content-type: application/pdf'); echo $content; exit;
Download
The plugin has two versions:
- Version 0.2 that uses html2fpdf library. It’s small (121 KB) but doesn’t work with complex designs or foreign languages.
- Version 0.6 that uses MPDF library. It’s large (12.9 MB) but works with different languages and complicated designs.
Enjoy and let us know if you think it needs improvements.