In short you create your PDF template, create blank PDF with just your data fields, and paste the new PDF as a watermark on top of your PDF template. I won't go into too much detail about exactly how I did this. Then came my experience with Python, PyPDF2 and reportlab. Either way there was a lot of copying a pasting code. Some of this is likely due to my experience level with VBA. I still felt as if every PDF template had to be setup completely separate.
I would highly recommend this route if you're going to use VBA. This works much better because you can access the PDF form fields using VBA and Java Script. Next I used VBA and the Acrobat reference to access and manipulate PDFs. Plus if the form changes or you want to add a new form it's basically like starting from scratch. The problem here is that it's painstaking to set up.
Python rotate pdf page pypdf how to#
Think "how could I do everything by use of just the keyboard shortcuts?" Once you know how to open a PDF with shortcuts, tab through the form fields and use shortcuts to save, you can automate this in VBA. I've wrote a VBA script to fill out a PDF using "send keys".
First let me say I'm no VBA expert but I have experimented with solutions here as well. Needless to say I've either created or borrowed several solutions. It's fairly routine for me to be manually filling out PDF files to process transactions. It's amazing my job has so many manual tasks that require filling out PDFs. Over the years I've tried several approaches to filling them out in an automated way.