Creating signable form with ultimate goal of PDF

By: Rob LeVine | Asked: 01/05/2023
ForumsCategory: How-toCreating signable form with ultimate goal of PDF
Rob LeVineRob LeVine asked 2 years ago
I'm embarking on a new journey here and looking for any tips from people who've done something like this before.  It's kind of a two-part question   I have a service in which two parties are involved. let's call them Shipper & Receiver.  The form used for setting up the service is quite long.  When the Shipper & Received are matched, I need to take information from the service entry, plus information from other form entries (e.g., company logos) and create a document (let's call it "Agreement") that both users can sign online and once both signatures have been added, a PDF is generated and made available to both parties.   My thought for Step 1 is to create a new form called "Agreement" and once the match occurs, I create a new entry and copy into it all the necessary information from the other form entries.  Does that sound wise? Step 2 (question 2), creating the PDF, is eluding me, because of all the "special things" needed to display, such as the company logos and a repeater of dynamic length (i.e., is at least 2 and could be 10 or more items).  I've looked at e2PDF and it seems like I can get part of the way there but not all the way.  If I create a PDF template and assign form fields to it, I don't see how I work the dynamic-length repeater into it such that the fields below it don't get overrun.  If I don't use a template, then I'm just going to get a PDF of the form itself and it's not very pretty.
Victor Font replied 2 years ago

You could output a view to PDF.

Bobby Clapp replied 2 years ago

There continues to be no great PDF solution. The closest I've ever seen produced is with html2pdf https://github.com/eKoopmans/html2pdf.js

Even then it's just so much work...

Rob LeVineRob LeVine replied 2 years ago

Thanks @Victor Font and @Bobby Clapp - I think that I might have come up with my own solution. I create an e2PDF template and then fill it with "HTML objects", each of which has as its content a shortcode to a custom PHP program that generates the HTML that is displayed. I make use of the e2pdf_model_shortcode_url_data filter to pass the entry id via the URL so my PHP code can get it from the $_GET variable. So far so good.

I've used html2pdf before and will revisit to see if it'll work better than my solution.

Bobby Clapp replied 2 years ago

Thanks for sharing, Rob.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right