About › Support › Visitor Tracking › I would like to create various .pdf reports
- This topic is empty.
-
AuthorPosts
-
13th October 2019 at 5:59 pm #2937
Pastor Andres
ModeratorI am requesting instruction on the basic structure/architecture of the pdf generation system you are employing in order to create some custom pdf reports.
If you are willing I would be able to send you all that I create for possible inclusion in your product.
I understand that all custom scripts would be overwritten with every update requiring us to re-upload them.
I am an experienced programer.14th October 2019 at 9:00 am #4355Andy Moyle
KeymasterWe use the fpdf.org PDF generation script to create PDFs.
The US uses different page sizes from the rest of the world, so page size is stored in a WordPress option obtainable from get_option(‘church_admin_pdf_size’);
If you look at pdf-creator.php you will see the other PDF scripts. Some of the scripts are quite old and clunky – church_admin_tickets_pdf() is a better example.The PDFs are generated on the fly as caching them is a security vulnerability for snoopers.
They are called from church_admin_download() in index.php and I use WordPress nonces to ensure they are only generated by clicking links created on the site.One issue with PDF creation is accents (diacritics) etc. WordPress sites are usually UTF-8 character encoded which doesn’t work in PDFs which use a different encoding. I’ve tried various ways of sorting the issue to work worldwide. The slightly clunky but viable solution is to escape all text to be output with urldecode(church_admin_encode()). An example is line 59 of pdf-creator.php
Send them over once done as they may be worth including for everyone!
14th October 2019 at 7:13 pm #4364Pastor Andres
ModeratorThank you again! I love your app and can’t wait to have something to contribute!11
30th October 2019 at 5:13 pm #4371Pastor Andres
ModeratorIn reading the docs for FPDF I found that there is a class/script called tFPDF that solves the UTF-8 unicode problem.
http://www.fpdf.org/en/script/script92.php2nd December 2019 at 9:54 pm #4400Andy Moyle
KeymasterPlugin now uses that tFPDF, which was hopelessly out of date so I added some bits to it, so it matches FPDF methods.
Note the fpdf manual is also unhelpful as the dejaVuCondensed font is condensed and doesn’t have the diacritics in it!!! -
AuthorPosts
- You must be logged in to reply to this topic.