Viljami Kuosmanen
Forum Replies Created
-
Sure! How about:
<?php if( false !== strpos( $_SERVER['REQUEST_URI'], 'pdf-preview' ) ) : ?>Forum: Plugins
In reply to: [WordPress PDF Templates] Dynamic Content (Portfolio)Glad to help!
Yes, unfortunately the DOMPDF library isn’t quite perfect at rendering modern HTML in the same manner that browsers do. It’s the best thing currently available though.
I’ve found that it is possible to fiddle about with the output to get the results you need with relative ease. The end product can be quite satisfactory that way.
– Antti
[topic marked as resolved]
Forum: Plugins
In reply to: [WordPress PDF Templates] Protected content[marked topic as resolved]
Forum: Plugins
In reply to: [WordPress PDF Templates] Dynamic Content (Portfolio)Hi! Thanks for using our plugin!
To return to your original question about the dynamic content on the print page; you might want to enable this option in you wp-config.php to disable caching the pdf output
define('DISABLE_PDF_CACHE', true);This fixes problems with any dynamic content being outdated on the pdf output.As the plugin is still quite fresh, we unfortunately don’t have much documentation on customising the pdf templates. Essentially, the plugin should however be able to turn any HTML file into a PDF.
To load your default stylesheet for example, just add this into the
<head>section of your pdf-template file.<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>">.However, I suggest you instead create custom stylesheets for the PDF template due to DOMPDF and your browser rendering stylesheets slightly differently. You may need to apply some special CSS rules for the print template.
The easiest way to customise your print page, is by looking at your /pdf-preview/ endpoint and customising your index-pdf.php file located in your theme directory.
Let me know if I can be of any more assistance!
– Antti
Forum: Reviews
In reply to: [WordPress PDF Templates] Great plugin, easy pdf configurationWonderful work! Thanks to you, we now have PHP 5.2 compatibility.
Would you share your work by creating a pull request on GitHub? I would love to add you as a contributor to the next version of the plugin.
GitHub link: https://github.com/anttiviljami/wp-pdf-templates
The
wp_headhook is most likely not working because there is no call towp_head()in your template file.Thanks for the review!
Forum: Plugins
In reply to: [WordPress PDF Templates] product post typeAt 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]
Forum: Plugins
In reply to: [WordPress PDF Templates] product post typeHi!
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
Forum: Plugins
In reply to: [WordPress PDF Templates] Dynamic ContentHi, and thanks for trying out our plugin!
I’m glad you found a solution to your issue. Please make sure to move the line
define('DISABLE_PDF_CACHE', true);to your wp-config.php to make sure your changes won’t be overwritten when updating the plugin.All the best,
AnttiForum: Plugins
In reply to: [WordPress PDF Templates] Protected contentMy guess is PDF rendering fails because WP PDF Templates can’t access the /pdf-template endpoint to render it. The same sort of thing can occur if the page being rendered requires some sort of session authentification.
Can you make an exception to the access control plugin or perhaps somehow give the plugin credentials pragmatically? Maybe modify the plugin to send cookies along with the file_get_contents() request?
Let me know if I can help any further.
Cheers!
AnttiForum: Plugins
In reply to: [WordPress PDF Templates] images and text wrap[marked topic as resolved]
Forum: Plugins
In reply to: [WordPress PDF Templates] Protected contentHi! Thanks for checking out our plugin!
It looks like the access control plugin is restricting access to the /my-post/pdf endpoint because it doesn’t realise /pdf is just an additional parameter, not a separate post from /my-post.
Have you tried using GET parameters instead of rewritten endpoints? i.e. /my-post?pdf or /my-post/?pdf. Perhaps this way the access control plugin doesn’t think this is a separate post and grants access to the PDF version of the post.
All the best,
AnttiForum: Plugins
In reply to: [WordPress PDF Templates] Protected contentHi! Thanks for checking out our plugin!
It looks like the access control plugin is restricting access to the /my-post/pdf endpoint because it doesn’t realise /pdf is just an additional parameter, not a separate post from /my-post.
Have you tried using GET parameters instead of rewritten endpoints? i.e. /my-post?pdf or /my-post/?pdf. Perhaps this way the access control plugin doesn’t think this is a separate post and grants access to the PDF version of the post.
All the best,
AnttiForum: Plugins
In reply to: [WordPress PDF Templates] images and text wrapBrilliant! I remember facing similar issues with another app I was using DOMPDF in. This seemed to work there as well.
Please make sure you move the line
define( "DOMPDF_ENABLE_CSS_FLOAT" , true );to your wp-config.php to retain this modification even after updating the plugin. The file wp-content/plugins/wp-pdf-templates/dompdf/dompdf_config.custom.inc.php gets rewritten when the plugin updates.Cheers!
Antti
Forum: Plugins
In reply to: [WordPress PDF Templates] pdf from /my-post/print[thread marked as resolved]
Forum: Plugins
In reply to: [WordPress PDF Templates] Automating plugin action with a linkThread closed and marked as resolved.