SVG forms – A Use For Unidentified Foreign Objects

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.

This post is part of our “SVG Article Index” in these articles, we aim to help you build knowledge and understand SVG.

The following two tabs change content below.
Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He often has no idea what to write in his blog posts but tries his hardest to make them interesting and entertaining, he also makes no excuses for his odd sense of humor.

Related Posts:

KieranF

About Kieran France

Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He often has no idea what to write in his blog posts but tries his hardest to make them interesting and entertaining, he also makes no excuses for his odd sense of humor.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>