Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've used (in PHP) TCPDF (was FPDF) and FPDi, FPDI extends TCPDF to import the PDF original (used as a background/template) and then TCPDF can write content (text, lines, shapes, images, etc.) on top of it.

Using fillable PDFs... A lot of PDFs I encountered didn't have fillable fields or were those provided not as large as I needed to fill properly, so mapped the content on top of the PDF ignoring any forms. (might not be possible if the forms preform some other function than just to populate the form)

Initially I would identify fields and create a form content database/array.

Overlay a grid on the "template PDF" with the TCPDF (point measurement is the PS/PDF standard) and hand determine the field location coordinates. (Making an HTML overlay won't cut it you need precise measurements.)

Add in some paging logic for handling multi page data, etc. and have it put it all together.

...

But PHP isn't one for signatures, so Python would be best...

Looking at resources like I've done in in PHP, you have to use two libraries - one to import the pages (with PYPDF2) and then to create the content on the imported page (pyfpdf). Looks like they are exclusive, bso you create content, then merge pdf template with content PDF.

Someone wrote an example: https://gist.github.com/dwayneblew/79da32727358b502f6ec

This should get you closer I think.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: