Support » Plugin: WP Post to PDF Enhanced » Files not found in cache if link to PDF view is not accessed from same page

  • Hi again, I did exactly as I described on here, and managed to get the files to download. However, now I’m running into a weird issue, which I believe has to do with the cache.

    If I click on a “Download PDF” link (from the admin backend) to a file I’ve never downloaded before, I get all sorts of weird errors, such as this one:

    Warning: imagepng(/home3/user/public_html/site/wp-content/plugins/wp-post-to-pdf-enhanced/tcpdf/cache/__tcpdf_imgmask_alpha_a0cba590a9ba3fc3a1104fa925759924): failed to open stream: No such file or directory in /home3/user/public_html/site/wp-content/plugins/wp-post-to-pdf-enhanced/tcpdf/tcpdf.php on line 7242

    However, if I go to the page I want to download as a PDF, and click on the link there, the file is generated without issues. Also, if I go to the admin page and click on the link, the file is downloaded correctly.

    I’m generating the custom post type programmatically, but it doesn’t seem to make a difference with the error shown, as I also tried creating the post myself and downloading it, with the same results.

    Should I try and generate the cache manually? If so, how would I do that?

    Thanks in advance, and thanks for the great plugin as well.

    https://wordpress.org/plugins/wp-post-to-pdf-enhanced/

Viewing 1 replies (of 1 total)
  • Plugin Author Lewis Rosenthal

    (@lewisr)

    The link is only meant to be accessed from the front end of the site, and not the back end. Frankly, as I’ve never even tried doing that from the back end of the site, I have no suggestion for this condition.

    The cache is generated by requesting a pdf. In this case, however, the plugin is looking for the cache directory in the wrong place, because it’s not picking up on the configuration file under tcpdf/config. This is probably because the plugin is being fired from the back end, and such an event has not been foreseen.

    Off the top of my head, I do not have any good suggestions for you; sorry. I understand what you are trying to do and why you want to do it, however, if you have cache enabled, the first time a user on the front end selects the post or page as a PDF, the resulting file will be added to the cache. Unless you have really, really huge posts or pages, there shouldn’t be much of a performance hit, and then, only the first time the PDF is requested.

Viewing 1 replies (of 1 total)
  • The topic ‘Files not found in cache if link to PDF view is not accessed from same page’ is closed to new replies.