For awhile now we have been adding forms functionality to the pdf to svg extractor so the forms found on the pdf page will appear and function as they do in original pdf.
As those of you may know svg has support for text areas that can be set to be editable. So in order to add the full functionality we require for extracted pdf pages we needed to find some other way to have the forms appear on page with the required functionality.
In the end we decided upon using foreign objects containing html to display the forms and javascript to interact with the forms. Foreign objects can be used within svg files to allow us to embed html objects that will be handled be the browser and displayed in the given position.
There are some disadvantages to using foreign objects, some browsers do not support foreign objects as well as others. For instance, at the time of writing, Opera would display the forms when they are first loaded then after that they are replaced with markers showing an issue with the content in the area of the form components. Foreign objects also allow you to place foreign objects outside of the area defined by the svg object. These objects will appear but only under unique circumstances. This can be an issue as we centre the svg image using the style attribute. The svg image may be centered but the foreign objects within the svg object are not.
Despite these disadvantages this option for forms within svg is possibly the best option for the extractor. It gives us access to all the form components that are required and the ability to later add javascript to these forms to mimic the pdf functionality perfectly.
Latest posts by Kieran France (see all)
- Embedded base64 images, html and svg differences - June 12, 2013
- Changes to PDF printing - June 5, 2013
- Drawing Java Components without displaying them. - May 21, 2013
- Only hit the button marked “System.exit” in an emergency! - April 30, 2013
- When supporting the spec just isn’t enough - April 3, 2013
