• Resolved blueocean109

    (@blueocean109)


    This looks like just the plugin I’ve been looking for, thank you for making it happen!

    I’m trying to see if this will work for Woocommerce single products page. I added the script below to the function.php file, however I’m getting a “Failed to Load PDF document” message when I add the /pdf/ infront of the product page url. The post type for Wocommerce products are indeed ‘product’

    // add pdf print support to post type 'product'
    if(function_exists('set_pdf_print_support')) {
    	 set_pdf_print_support(array('post', 'page', 'product'));
    }

    I also tried creating a template called single-product-pdf.php and put it in my theme folder, but still getting the same message.

    You advice would be very helpful.

    https://wordpress.org/plugins/wp-pdf-templates/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter blueocean109

    (@blueocean109)

    Looks like it was the dynamic content problem that the other support question brought up, which the plugin author already answered 🙂

    If anyone is using this for Woocommerce single product page, just add the code below to your wp-config.php

    define('DISABLE_PDF_CACHE', true);

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Hi!

    Thanks for using our plugin. I’m glad you found a solution to your problem.

    However, since WooCommerce product pages should be fairly static, this isn’t really the same issue as the dynamic post content problem. There wasn’t an issue opening the PDF file in that case either. I for one, have successfully used this plugin with caching enabled on WooCommerce single product pages.

    I suspect the real issue here lies with file permissions. The only difference DISABLE_PDF_CACHE makes, is that it doesn’t try to write the PDF file on disk.

    The error message “Failed to Load PDF document” sounds like the PDF file doesn’t exist in your uploads directory, which could be due to bad write permissions. Are you getting any errors or warnings in your php error log when using the cache?

    You can try adding this to your wp-config.php to see if wp-pdf-templates gets any errors during PDF generation.

    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting(-1);

    Although, if the PDFs generate fast enough for you, and you have server performance to spare, perhaps the caching functionality isn’t even needed here. Why fix something that’s not broken? 🙂

    Cheers!

    Antti

    Thread Starter blueocean109

    (@blueocean109)

    Hi Antti,

    Thanks for the swift response.

    I checked the php error log with the cache on and not seeing any relevant errors added.

    I also tried adding your code to my wp-config.php, but getting the same “Failed to Load PDF document” message.

    Either way, You nailed it on the head, it ain’t broke 🙂

    Since we are setting this up to print product labels by internally staff, I don’t think it will be used frequent enough to put any load on the server.

    Did I mention, I’m Really glad you’ve created this plugin!

    Plugin Author Viljami Kuosmanen

    (@zuige)

    At your service! Hope the plugin comes in useful.

    If you like, you can review the plugin to help spread the word. 🙂

    [thread marked as resolved]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘product post type’ is closed to new replies.