I would like to create various .pdf reports

About Support Visitor Tracking I would like to create various .pdf reports

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2937
    Avatar for Pastor AndresPastor Andres
    Moderator

    I 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.

    #4355
    Avatar for Andy MoyleAndy Moyle
    Keymaster

    We 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!

    #4364
    Avatar for Pastor AndresPastor Andres
    Moderator

    Thank you again! I love your app and can’t wait to have something to contribute!11

    #4371
    Avatar for Pastor AndresPastor Andres
    Moderator

    In 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.php

    #4400
    Avatar for Andy MoyleAndy Moyle
    Keymaster

    Plugin 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!!!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.