When you change the href property in a PDF form at runtime, images no longer load dynamically in Adobe Reader/Acrobat 8 and later versions.
Here are some suggested workarounds used in different situations to get avoid this issue:
- Solution 1: Embed the images in the form as hidden objects.
- Add the image to the form in Designer, and set its presence to “hidden” in the object panel.
- Then set the image field’s presence to “visible” on the “initialize” event, or the “click” event of a button.
- Repeat for each image that you want to use on the form.
Note: This solution is only applicable when you use a few images. This solution affects performance, but if the images are in a compressed format, the effect can be minimized.
- Solution 2: Upload the images as attachments.
- Do one of the following to upload the images as attachments:
- Use the attachment panel in Acrobat (View > Navigation Panels > Attachments > Add).
- Solution 3: Use either a web service or a database connection.
- Configure a web service or database connection to return a string that contains Base64-encoded image content. (To build a web service or a database connection is complex and requires some custom coding, so it is out of the scope of this blog entry.)
- Open the form in Designer and go to the “Data View.”
- Add a new Data Connection.
- Select OLEDB Database, or WSDL file. (Press the Help button on this dialog in Designer to get more context help on how to configure each data source.)
- Add an image field to the form.
- Go to the Object panel and set the Binding for the image field to the return object from the web service or database.
- Solution 4: Use the Privileged folders functionality in Acrobat 9+.
- Put all the images in a folder on a network share, available to all computers that access the form.
- Open the enhanced security settings in Acrobat/Reader 9 (Edit > Preferences > Security (Enhanced)).
- Add a folder path or the host name where the images are stored. The folder path tells Acrobat/Reader 9 that the path for the images is exempt from the enhanced security settings.
Note: Only try this solution after approval from your system administrator. You are essentially disabling some of the security features of Acrobat or Reader, which are there to prevent potential hacker attacks.
There were a few reasons for this change in the security settings:
a) A form could point to a “file://” URL for data mining purposes.
This condition allows for potential hacking as external parties see where the pictures are stored, and the names of the files on your computer. For example, they could see that the pictures were stored under My Documents\Pictures and that all had names like PIC000xx.JPG.
b) PDF documents are supposed to be self contained.
Pointing to an “ftp://” or “http://” URL to load an image dynamically breaks that promise. When a user certifies a document for example, the user certifies that the content of the document is safe. However, if the document dynamically loads an image, that image file stored on some web server can be changed without breaking certification. But, the meaning of the document can be different.
Consider the following situation where the content of the PDF reads:
|You owe me:|
…but could be changed to…
|You owe me:|
….just by changing the image on the server.
c) The same issue could appear with a signed document.
If you sign the document, you are signing the form in its current state and agreeing to the content as it stands. If the image on the server changes afterwards, the signature would still be valid. As some Adobe customers use signatures in legally binding workflows, Adobe cannot allow the content to change without reflecting that in the PDF or the signature.
The strategy moving forward is to have encapsulated PDF files remain true to the PDF specification. If you find another workaround to allow the images exist outside the PDF, it is also likely that Adobe would disable it in some future version of Reader and Acrobat.
You could change the href property in Reader up to version 8.0. But from 8.1 onward the security was tightened and potential security holes, like this one, were closed.