• Resolved Viszt Péter

    (@passatgt)


    Hi!

    I’m trying to use your plugin to generate some reports based on custom post types.
    When i’m using ?pdf-preview , it works fine, however when i try to generate a pdf using ?pdf, it will show just a blank white pdf page. WP_DEBUG generates this:

    Notice: Undefined index: Cache-Control in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 315
    
    Notice: Undefined index: Pragma in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 315
    
    Warning: Cannot modify header information - headers already sent by (output started at XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php:315) in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 347
    
    Warning: Cannot modify header information - headers already sent by (output started at XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php:315) in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 348
    
    Warning: Cannot modify header information - headers already sent by (output started at XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php:315) in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 349
    
    Warning: Cannot modify header information - headers already sent by (output started at XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php:315) in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 350
    
    Warning: Cannot modify header information - headers already sent by (output started at XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php:315) in XXXX/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 351
    %PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R >> /MediaBox [0.000 0.000 612.000 792.000] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (DOMPDF) /CreationDate (D:20141103205814+00'00') /ModDate (D:20141103205814+00'00') /Title (? Log In) >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 8 >> stream x? endstream endobj xref 0 8 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000251 00000 n 0000000280 00000 n 0000000412 00000 n 0000000475 00000 n trailer << /Size 8 /Root 1 0 R /Info 5 0 R >> startxref 553 %%EOF

    Any idea whats wrong?

    Thanks!

    https://www.ads-software.com/plugins/wp-pdf-templates/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Viljami Kuosmanen

    (@zuige)

    Thanks for checking out our plugin!

    This is a small bug that has already been fixed in the next release version of the plugin. In the meantime, you should disable warning messages on production sites with error_reporting(E_ERROR | E_PARSE); in your wp-config.php

    Sorry for the inconvenience. The final fix for this came into existence just over the weekend.

    Cheers!

    Thread Starter Viszt Péter

    (@passatgt)

    Hi!

    Thanks for that fast reply. I just tried adding error_reporting(E_ERROR | E_PARSE); to my config file, but sadly it still generates an empty pdf page. Just tried it on localhost and its working fine. So i’m guessing its a server/hosting issue. Any idea whats need to be enabled to generate the pdf file correctly?

    Thanks!

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Hi!

    Make sure you have turned WP_DEBUG off and display_errors is set to 0. In production environments, you generally shouldn’t have those set anyways.

    Hope this helps.

    – Antti

    Thread Starter Viszt Péter

    (@passatgt)

    Its turned off, all ready to go but the pdf file is still blank:(

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Hmm, did you try to hard refresh the page? Try sending no-cache headers to the script by cmd + shift + R (ctrl + F5 on windows) to make sure the blank pdf file hasn’t been cached.

    You can also try setting define('DISABLE_PDF_CACHE', true); in your wp-config.php

    Thread Starter Viszt Péter

    (@passatgt)

    Sure, i did, tried with different posts too. I still think its a hosting issue, because the same exact site works on my localhost. Any tips what to look for, dompdf needs any special php functions that might be turned off in some cases?

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Hard to say. I’ve never run into this issue. Look at your php error log to see if there’s anything interesting in there.

    define('DISABLE_PDF_CACHE', true); didn’t work either?

    Thread Starter Viszt Péter

    (@passatgt)

    Yes, tried with disable_pdf_cache too, no luck. Also tried with a different theme and disabled all other plugins to avoid any conflict, still no luck:(

    Thread Starter Viszt Péter

    (@passatgt)

    Hm. I just tried it on another site with the same hosting and its working! So i’m not exactly sure whats going on, but looks like a theme or plugin issue after all. I’ll try to get back to you once i figure out whats going on:)

    Plugin Author Viljami Kuosmanen

    (@zuige)

    I’ve just updated the plugin to version 1.3.8, with a patch to the aforementioned issue. See if updating the plugin will help.

    Thread Starter Viszt Péter

    (@passatgt)

    I found the issue!:)

    I’m using Theme My Login to create a private site and when TML / Settings / Security / Private Site is checked(you’ll be redirected to a login page always if not logged in), it will generate a blank pdf:) Weird, because with another theme, i can see the login form on the pdf file, but my theme is completely blank. Anyway, i turned off the private site option and the pdf is generated properly:) I’ll try to come up with a solution and i’ll post it here so people can find it if needed.

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Glad to hear it! ??

    A solution already exists in the plugin itself for sites that utilise some sort of access control. Just enable define('FETCH_COOKIES_ENABLED', true); in your wp-config.php and you should be fine.

    Cheers!

    Thread Starter Viszt Péter

    (@passatgt)

    Nice! Thanks, that was the fix i needed:)

    Awesome plugin btw, well-written code:)

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Thanks for using our plugin. Hope you do something awesome with it! ??

    [marking topic as resolved]

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Preview works, but pdf is blank’ is closed to new replies.