Lyndon Armitage Lyndon is a general Developer. He has a keen interest in AI and Games Programming and runs a blog that he periodically updates.

JavaScript in PDF to HTML5 Conversion: Formatting & The Field Object

48 sec read

It has been a while since the previous article on our work with converting JavaScript from PDF documents to work with extracted HTML5 from our converter so if you didn’t catch the start of them you can view it here.

In my previous post I spoke about the Event object and mentioned in passing the Field object. When writing that post we were just using the built into HTML/JavaScript input and form elements/object to display and store the results of events which worked up until a point but prevented us from completely emulating how PDF forms work.

Specifically this prevented us from emulating how fields were formatted upon leaving them. To rectify this we implemented our own version of the Field object described within the Adobe’s API and tied it into the form objects currently used. This means that now upon leaving a form field it is not only calculated correctly but also formatted correctly so.

For those interested, this specific behaviour is caused by the embedded JavaScript in a field objects Format object:

AFNumber_Keystroke(2, 0, 0, 0, '', false);

We’ve also implemented the behaviour for pressing Return/Enter within a field. Originally this had been overlooked.

We are well on our way to getting all the features of the JavaScript embedded into PDFs, are there any particularly interesting interactive PDFs you’d like to see converter?

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Lyndon Armitage Lyndon is a general Developer. He has a keen interest in AI and Games Programming and runs a blog that he periodically updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.