Adobe Javascript

Pasting paste

Pasting paste

I occasionally create PDF forms for work that would be a lot more useful with just a little bit of logic.  Luckily, PDF’s can run javascript.  To save me from having to continually search for this same information every few months, I’m copying and pasting a piece of an Adobe forum thread here:

// Obtain the value from the first field

var v1 = getField(“balance1”).value;

// Obtain the value from the second field

var v2 = getField(“amount2”).value;

// Set this field value equal to the sum

event.value = v1 + v2;

That should do it.

Photo courtesy of pvera.

Creating PDF’s on the fly using PHP and TCPDF

I’ve got a separate website that used to offer a service where you could get a custom report in the form of a PDF sent to you.  For that I used a free open source PHP script/library called FPDF.  It’s reasonably well documented, but there are a lot of nuances that not really intuitive.  Used in combination with a script called FDPI for importing an existing PDF’s, mixing in a little data from users, databases, and the internet, and it was a pretty amazing thing.

An acquaintance of mine suggested I take a look at a similar library for creating PDF’s with PHP called TCPDF.  The documentation borders on the compulsive – which I sincerely appreciate.  While the immediate downside is that it does not have a built-in PDF importer, it is apparently compatible with the aforementioned1 FDPI.  The part that I really like about TCPDF from scanning through these examples is the robust HTML rendering engine.  It would be a really amazing to be able to dump a chunk of HTML directly into a PDF without having to design a script to read through it all, parse it, and then format it specifically for the PDF.

  1. Who the hell uses THIS freaking word?! []