Print WordPress posts as PDF. Optional with Geshi highlighting. It also has support for password protected posts and only logged in users can print post as pdf support.

Note: You can find the development repository at Github: https://github.com/fkrauthan/wp-mpdf


This file is part of wp-mpdf.

wp-mpdf is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

wp-mpdf is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with wp-mpdf. If not, see http://www.gnu.org/licenses/.


  1. Upload the whole plugin folder to your /wp-content/plugins/ folder.
  2. Set write permission (777) to the plugin dir folder => /wp-content/plugins/wp-mpdf/cache
  3. Go to the plugins page and activate the plugin.
  4. Add to your template
    if( function_exists( 'mpdf_pdfbutton' ) ) {

    or as a small button
    if( function_exists( 'mpdf_pdfbutton' ) ) {
    mpdf_pdfbutton( false, 'my link', 'my login text' );

    The second text specifies the text which should displayed if you have checked “needs login” and a user isn’t logged in. (if you wish to open the pdf print in a new tab you may pass “true” for the first parameter)
  5. You can adjust some options: in your admin interface, click on plugins and then on wp-mpdf. For allowing or disabling pdf export you can use the checkbox when creating/editing a post or a page.
  6. Place your templates into /wp-content/wp-mpdf-themes

The mpdf_pdfbutton function signature:
function mpdf_pdfbutton( $opennewtab = false, $buttontext = '', $logintext = 'Login!', $print_button = true, $nofollow = false, $options = array() )

The options array supports
'pdf_lock_image' => '/my/image/path/relative/to/wordpress/route'

'pdf_image' => '/my/image/path/relative/to/wordpress/route'

to overwrite which icon should be used.


Апрель 21, 2022-ж.
This plugin is amazing. It's lightweight and powerful at the same time. The PDFs can be customized within the templates to any needs. After a long search for a PDF generator i finally found this. Thank you so much for the great work. It's perfect.
Октябрь 15, 2020-ж.
Thank you for this nice working plugin. I also really like the cache and download history functionality.
Январь 16, 2020-ж.
Independent of any platform : works perfectly with wordpress 5.3.2! It is extremely useful for a wordpress scientific publication website CSS customization is a bit difficult but the results superb (with footnotes, references, custom post type...)
Сентябрь 30, 2019-ж.
Great plugin, it just *works*! After some trial and error I made it also to use my own template by pulling data from a BuddyPress user and display it as a contact info sheet. Thanks!
Май 2, 2019-ж.
I wanted to provide a way for my visitors to download posts as PDFs and began to google for solutions. First of all it seems, that "post to PDF" can be understood in a couple of ways. I wanted to have it a simple way: on a post page a button, that opens a new window with the PDF to be saved or shared. I found a couple of plugins, that didn't work in my environment, server error 500. I found some with annual fees. Well, I don't mind paying for services per se, but this is a gratis site, and so far donations aren't flowing in. Then I found one with an output, that ,eh, leaves a lot to desire, until I found this. To tell the truth it took me a while to figure out how to get the button on a post. And I like to my some minor formatting on the PDF, but overall effect is wow! Nice PDF, as if I had myself manually done 🙂
Read all 16 reviews

Contributors & Developers

“wp-mpdf” is open source software. The following people have contributed to this plugin.


Translate “wp-mpdf” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Added missing files to plugin


  • Updated mpdf to version 8
  • Added mpdf_adjust_settings filter to allow overwriting any mpdf settings


  • Fixed release tag to prevent install issues


  • Removed manual cron job and used wp-cron instead for cache population (as per wordpress guidelines)
  • Removed PHP 4 support (don’t think anyone is running that anymore)


  • Added some small security improvements for the admin page
  • Fixed a PHP notice when “allow to print all pages” is disabled (thanks to grandeljay)


  • Added some small security fixes to the admin page


  • Added support to change page format inside template (thanks to conlaccento)


  • Made codebase PHP 7.3 compatible (thanks to nopticon)
  • Fixed issues with newer wordpress versions (thanks to nopticon)


  • Fixed some small bugs
  • Updated mpdf to version 6
  • Updated geshi to latest version
  • Made plugin compatible with PHP 7

Earlier versions

For the changelog of earlier versions, please refer to the separate changelog.txt file.