How to load dynamic images in a PDF file using Adobe Reader/Acrobat 8+

Issue

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.

Solutions

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.
  1. Add the image to the form in Designer, and set its presence to “hidden” in the object panel.
  2. Then set the image field’s presence to “visible” on the “initialize” event, or the “click” event of a button.
  3. 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.
  1. Do one of the following to upload the images as attachments:
    • Use the attachment panel in Acrobat (View > Navigation Panels > Attachments > Add).
  2. Update the value of the image field using script at runtime to point to the attachment. (See the “Opening and saving attachments” section in the Javascript scripting guide)
  • Solution 3: Use either a web service or a database connection.
  1. 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.)
  2. Open the form in Designer and go to the “Data View.”
  3. Add a new Data Connection.
  4. 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.)
  5. Add an image field to the form.
  6. 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+.
  1. Put all the images in a folder on a network share, available to all computers that access the form.
  2. Open the enhanced security settings in Acrobat/Reader 9 (Edit > Preferences > Security (Enhanced)).
  3. 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.

Additional Information

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.

Note

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.

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 9.3/10 (4 votes cast)
How to load dynamic images in a PDF file using Adobe Reader/Acrobat 8+, 9.3 out of 10 based on 4 ratings

Comments are closed.