Populating PDF Forms Using Visual Studio

Populating PDF Forms Using Visual Studio

Sample of the Week:

More than any other computing platform, mobile devices lend themselves to filling out PDF forms. Being able to easily rotate the screen to match the orientation and aspect ratio of a paper document makes the process of filling the PDF intuitive and easy. With the release of Adobe Acrobat Reader DC signing forms on these devices is as easy as finger painting… but without the mess.

However, the capabilities of the various PDF viewers on mobile devices and desktops vary widely. PDF was originally designed to provide a consistent experience across operating systems and platforms for static, final-form documents and most PDF viewers get the static parts of the document mostly right for basic business documents. The problems start when you have an interactive PDF. Different PDF viewers treat interactive elements differently… they shouldn’t… but they do. The worst of them will allow you to save the modified PDF and then break it in the process by removing any interactive elements that it doesn’t understand.

madeforIEFor form developers, this is a problem. I get several calls or emails a week asking how to force users to view their PDF in a particular browser… or alternatively, how to prevent a user from opening the file in… for example… Apple Preview. It’s starting to remind me of the days of the early browser wars when sites would tell you what browser their code was tuned for.

Fortunately, the Datalogics PDF WebAPI allows developers to populate PDF forms with data on a server but also to have that form behave as though it were being viewed in Adobe Acrobat. All of the calculations and formatting scripts are interpreted the same way as Acrobat and you can even flatten the form so that just about any PDF viewer can display the data correctly even if it can’t modify it.

By creating the PDF WebAPI Connected Service Extension for Visual Studio, we’ve made it much easier to develop applications that leverage the PDF WebAPI so that developers can populate PDF forms without knowing anything about the PDF file other than the names of the form fields. To experience how easy this is, clone this repo and follow the instructions in the README.md file.

The sample input file has several PDF text fields and check boxes that the application will populate with the data that you enter. The lower half of the file has two calculated fields that demonstrate the field calculations that I mention above. As we add more capabilities to the Visual Studio extension, you’ll be alerted to download the updates as they come out and over time, you’ll be able to do more and more with your PDF files through the PDF Web API.

Leave a Reply

Your email address will not be published.