• Almost 2 years on and my previous post (closed) is still an issue that others must be facing.

    The line numbers in question are now 944,945 and 948

    // Fix https://www.ads-software.com/support/topic/problems-with-image-files
    // Turn off output buffering to decrease cpu usage
    //@ob_end_clean();
    //@ob_clean();
    
    // required for IE, otherwise Content-Disposition may be ignored
    //if (ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off');
    

    There seems to be a conflict with caching plugins, I think this might relate to gzip compression.

    PDF files are “corrupted” on download, but if you change the file extension to .pdf.gzip and open them with 7Zip the PDF file inside is viewable.

    I specifically use Litespeed plugin as I have a Litespeed server, but I think the issue will be similar for others such as WP Rocket and Total Cache since they all force gzip compression.

    For me commenting out these lines made everything play nice together

    /src/php/core-addons/private-file/private-file-default-handlers.class.php 941,942 and 945

    https://www.ads-software.com/support/topic/pdf-download-issue-2/
Viewing 1 replies (of 1 total)
  • Plugin Author Thomas

    (@tlartaud)

    Hello there,

    Sorry for the inconvenience.

    WP Customer Area is actually a dynamically generated private area, which should only be accessed by logged-in users. Each page would be differrent, depending on the currently connected user.

    It is recommended to not cache those kind of pages, like you do not cache your wp-admin area, or your my-account page from woocommerce.

    Best and easiest way to resolve that would be to exclude any customer-area/* URLs from your caching system. I bet that, otherwise, you’ll face many other unexpected issues.

    For performance reasons, you could still keep CSS compression activated, for instance, but I don’t see any specific reason to cache a whole user-page (keep in mind that all pages from WPCA are actually user-specific pages, not public pages. You shouldn’t see any benefit caching the whole page, since they are not public pages, and since they need to be computed again for each user).

    However, I am not arguing your report is wrong.

    If you only comment out this line, is this still working ?

    //if (ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off');

    Or, do you also need to comment out both ob_clean functions to let it works?

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘PDF download issue’ is closed to new replies.