WordPress.org

Ready to get started?Download WordPress

Forums

wp-mpdf
[resolved] [closed] No PDF generated (14 posts)

  1. Jason Judge
    Member
    Posted 1 year ago #

    I've added the PDF link to my custom page template, and set it up as a whitelist page.

    When I click the link, a new tab options for the URL + output=pdf. This then redirects back to the HTML page, but no PDF is generated.

    All three cache directories are empty, apart from the .htaccess and dummy.txt files that come installed. The cache folders are writeable.

    Where should I be looking to find out what could be going wrong? Debugging is on, but I don't know where that is logged. The settings screen does not have any values in the "thema" dropdown, in case that is important.

    http://wordpress.org/extend/plugins/wp-mpdf/

  2. Jason Judge
    Member
    Posted 1 year ago #

    For a start, line 368 of wp-mpdf/wp-mpdf.php contains this:

    if($_GET['output'] == 'pdf') {

    It generates warnings, as it assumes the "output" element exists. This would be better:

    if(isset($_GET['output']) && $_GET['output'] === 'pdf') {

  3. Jason Judge
    Member
    Posted 1 year ago #

    If I use this in my page template, and am logged in (or not logged in), but have the "requires logged in" box unchecked:

    mpdf_pdfbutton('my link', 'my login text');

    the text this is displayed on the link is "my login text". According to the documentation, it should display "my link", if I understand correctly.

    If I don't supply that function with *both* strings (even though I'm not interested in limiting access to logged in users) then no link appears at all. Of course, it could be a link with no text, but I haven't checked that.

    If I do check the "requires login" box, then neither string supplied to that function is displayed. Instead it shows the link to the login page with the text "Login!". So, I realise the "not logged in text is actually the third parameter, and the second parameter is the "download PDF" string. The first parameter is a mystery.

  4. fkrauthan
    Member
    Plugin Author

    Posted 1 year ago #

    Your last problem with mpdf_pdfbutton: The documentation was wrong. You need to specify the following mpdf_pdfbutton(false, 'my link', 'my login text');. The first parameter defines if the link should be open in the same tab (false) or in a new tab (true).

    Line 368 is fixed with the next version (2.12.0) which should be out within the next 24 hours.

    Your main issue sounds like a different installed plugin is blocking the access to the pdf links.

  5. Jason Judge
    Member
    Posted 1 year ago #

    I have the "404 Redirected" plugin installed. Disabling that has turned the redirect into a white screen. It's a step forward...

  6. Jason Judge
    Member
    Posted 1 year ago #

    This is the error behind the white screen:

    Warning: require(/var/www/vhosts/[redacted]/httpdocs/dev-folder/wp-content/plugins/wp-mpdf/../../wp-mpdf-themes/.php): failed to open stream: No such file or directory in /var/www/vhosts/[redacted]/httpdocs/dev-folder/wp-content/plugins/wp-mpdf/wp-mpdf.php on line 426 
    
    Fatal error: require(): Failed opening required '/var/www/vhosts/[redacted]/httpdocs/dev-folder/wp-content/plugins/wp-mpdf/../../wp-mpdf-themes/.php' (include_path='.:') in /var/www/vhosts/[redacted]/httpdocs/dev-folder/wp-content/plugins/wp-mpdf/wp-mpdf.php on line 426
  7. Jason Judge
    Member
    Posted 1 year ago #

    This is line 425, and it does seem to be related to the fact that the setting page does not show any themes in the drop-down list. Have I missed something in the installation instructions? Do I need to install a theme:

    require(dirname(__FILE__).'/../../wp-mpdf-themes/'.get_option('mpdf_theme').'.php');

  8. Jason Judge
    Member
    Posted 1 year ago #

    I copied the contents of wp-content/plugins/wp-mpdf/themes/ to wp-content/wp-mpdf-themes/

    This has given me the the ability to select "default" as a theme in the settings page. The installation instructions says something about some theme files, which is guess is what this is about, but it was not very clear at all. I only found out about this by looking at the code.

    It is now telling me that the cache directories are not writeable (I am only seeing this with debug turned on, otherwise I would be totally in the dark). Now, I *did* set the cache folders to be writeable, but installing the last update has reset those folders.

    Two things I would suggest may help:

    1. Error reporting. Tell the user (or admin) that something is wrong when a folder cannot be written to, rather than just dump them into a while screen.
    2. Why no set the folder permissions during the install and upgrade process? If permissions cannot be set, then give the admin the instructions on what folders to change permissions on. There are three (or perhaps four) folders that need changing, so make it easy for the admin rather than having to go on a bug hunt and digging through documentation *every* time the plugin gets updated.

    It looks a great plugin, and it is much appreciated, and I'm just playing devil's advocate here - I would rather tell you what I think is wrong, and what would probably make a lot of other people give up long ago. Obviously take it or leave it, but all comments meant with the best intentions.

  9. Jason Judge
    Member
    Posted 1 year ago #

    Setting the write permissions, and I get a PDF document. Wooo :-)

    I'm displaying a custom page template - a price list that pulls products in from a custom post type, then groups them into major groups and tabulates the results into several tables.

    I guess I will need to put my custom template into the theme and make that selectable. This will have to wait until tomorrow though, as I need to work on other projects today. In the meantime, this is a good start.

    Feel free to close this issue once you decide if there are any actions for you to follow up.

  10. Jason Judge
    Member
    Posted 1 year ago #

    Another suggestion:

    If a wp-content/wp-mpdf-themes/ folder has not been created with any theme files in, then the plugin should perhaps fall back to the plugin internal theme folder. This would get it up and working out of the box a lot faster, and people can create their own theme files once they are ready to customise it.

    In my standard WP theme, my page uses a custom page template "template-prices.php". So I somehow need to create a wp-mpdf version of that template then link it in to the wp-mpdf theme. I'm guessing I would alter default.php to look at the selected page template, and if it exists, include it? Or maybe there is another way?

  11. fkrauthan
    Member
    Plugin Author

    Posted 1 year ago #

    I've created a new method for loading templates. First it looks up the custom user template directory (outside of the plugin folder so it doesn't get deleted on plugin update). If it can't find the template there it looks into the plugins own template folder. So there is no need any more to copy the default templates. I plan to publish a new version soon with some more bug fixes.

  12. harshida09
    Member
    Posted 10 months ago #

    HEllo
    I need your help... I have a same problem... I have downloaded this plugin and try to generate the PDF IN LOCALHOST... But is shows me the blank page/pdf... please suggest me what's wrong with this ... I need to submit this pdf project by tonight and i need your help ...

    Here is the code of my page wp-mpdf.php (WHOLE PAGE CODE)( I M USING THIS PLUGUN IS LOCALHOST)

  13. fkrauthan
    Member
    Plugin Author

    Posted 10 months ago #

    Is it possible that you have modified the plugin? I can't support customized plugins. But you should take a look into your php log and webserver log maybe you can find there what the problem is.

  14. @harshida09? Per the forum welcome can you please post your own topic?

    http://wordpress.org/support/plugin/wp-mpdf#postform

    Also please do not post that large amount of PHP code again. Use pastebin.com if you must.

    http://codex.wordpress.org/Forum_Welcome#Posting_Code

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.