|Impressario for Director||All||Customization of PDFs
INM Impressario allows you to replace bitmap images within your PDF documents at runtime via the ReplaceImage() method. The image you are replacing needs to be in a "container" within the PDF and you use the name of the container as a parameter to the method.
Unlike InsertImage(), used to insert an image within a placeholder when creating a new PDF from a template, ReplaceImage() does not alter the layers of object within the PDF document. So this means you can have multiple image layers and those that are over top of the one to be replaced will remain over top after the image is replaced.
However, when you distill your PDF, depending on the original source application, you may find that the image layers are not positioned correctly to use with the ReplaceImage method. This article shows how you can modify your PDF structure in Adobe Acrobat to rearrange the layers on the page.
In Adobe Acrobat click View > Navigation Tabs > Content. A window opens showing the tree-view structure of your PDF.
Click to open the page where you want Impressario to replace an image at runtime.
If the image is inside a "container" by itself, you just need to make sure that it is in the proper location within the hierarchy of objects on the page (objects at the bottom of the tree are positioned on top of objects at the top of the tree). You can adjust the position of the container by dragging it to a different spot in the tree.
If the image you want to replace is inside a container along with other objects, or if the image is not in any container, you can create a new container by right-clicking on the Page and selecting New Container... Give the new container a name and drag it to the desired location in the tree. Then drag the image to that container.
As a last step, make sure to name the container something meaningful for you -- you will use that name to refer to that image in the ReplaceImage() method.
In this example, I have an image which is beneath a semi-transparent rectangle on the page. I created a new container for this image, named "image1" and made sure to position it above the container that holds the paths for the rectangle: