Webmerge Alternative? Want to have a Knack record value inserted into PDF

I have a few PDF 'templates' and with each of them there is 1 line of fillable text.


I'm wanting to have a "download" button in record results that would pull the PDF, insert the "name" value from the knack record and generate the PDF for download.


Webmerge seems pretty expensive if we go over a few hundred downloads a month... any other alternatives?

I think it it possible also to generate the document for opening with TCPDF, they have a lot of examples in their library which are very helpful.

As I have told you, every time you generate a document with jsPDF you can get overwritten lines into it, it takes a lot of time to fix it, and if you have some times the data bigger then it will definitely give you a big headache.

My advine is to try to understand TCPDF, even if you will need a server to host the files, but at least it is a lot easier.

I was thinking to switch completely to it also, but I need time for that..   

Here you have an example of the code used with jsPDF and TCPDF:

pdf.setFontType("normal");
pdf.text(170, 52, "Den "+day+"-"+month+"-"+year);
pdf.setFontSize(14);
pdf.setFontType("bold");
pdf.text(20, 62, "KURSUSBEKRÆFTELSE");
pdf.setFontSize(9.5);
pdf.setFontType("normal");
pdf.text(20, 66, "Tak for kursusbestillingen hos Softworld. Vi beder dig om at læse bekræftelsen igennem og kontakte os, såfremt du \nfinder uoverensstemmelser i forhold til det bestilte.");
pdf.setFontSize(14);
 
 
here is how you can add a paragraph with TCPDF:
 
$html5= <<<EOF
<p align="center" style="font-size: 20pt;"> $client->Name</p>
EOF;
$pdf->writeHTML($html5, true, 0, true, 0);
 
On the first one you need to mention the height of the line, in the second one it is automatically and it will always be even, the same between all the lines. I am telling you this because I had to use a lot of time to fix the space between paragraphs and all sort of things like this.

Ultimately it would be a PDF generated and emailed to a customer, but alternately it would be nice to also store it as an attachment in Knack, or stored somewhere else and linked would be fine too. This would be a multi-page document similar to a business letter (with letterhead and text) and would contain various fields from the Knack database.

I was thinking one scenario would be to have the user click a button which would generate the pdf locally (preview it), then click another button to generate it again and Email it to the customer.

I like the idea of jsPDF because it doesn't rely on a server. I would prefer not to have to host anything additional outside of Knack.

Hi Kevin, Yes I have some examples. Meanwhile, I started to use also another package called TCPDF...

For downloading I have created the files with jsPDF and for creating and sending the files as an attachement I am using TCPDF.

With jsPDF it is a little messier because you have to set the space between lines, it is not going on new line if the text is longer than the page.. so you have to work a little to arrange the document.

With the second one is easier, because you can save the file on a server or somewhere and send it on an email.. 

So it depends on what you want to do with the pdf. I don't remember exactly if with the second one you can save the file on the local computer(download).

The jsPDF plugin can be used directly in knack with javascript and jQuery, but the other one can be used with php so I had to use a folder on my server and run it from there.

Let me know what kind of example you need and I can help you.

 

@Mariana I was wondering if you have an example of how you implemented jsPDF in Knack? Thank you.

I am using jsPDF to generate the PDF. It's free, you can find it's files on GitHub. You only have to write the code in JavaScript and it is very easy.