Get Image by name and replace

Hi,

We're looking to use the PDFNet SDK to replace text and image content
in order to produce print ready artwork. I'm currently replacing the
text content by using the following code:

'Save the changes to a new print-quality PDF
Dim doc As PDFDoc = New PDFDoc(Server.MapPath("/Docs/test.pdf"))
doc.InitSecurityHandler()

Dim field As Field = doc.GetField("FirstnameTextField")
If Not field Is Nothing Then
     field.SetValue(FirstnameTextbox.text)
End If

doc.RefreshFieldAppearances()
doc.FlattenFields()

doc.Save(Server.MapPath("/Docs/test_updated.pdf"), 0)
doc.Close()
doc.Dispose()

Is it possible to get hold of an image in a similar way (e.g by name)
instead of looping through all the page objects as per the examples?

Having read all the posts regarding replacing images I've so far been
unable to create a complete block of code that first finds a specific
image and then replaces it with a new image from an images directory.
If you could provide any examples of how to acheive this it would be
most apprechiated.

Finally, as the PDFs we'll be working with are print quality they're
generally going to be quite large files, up to 100MB. Is there
anything I need to keep in mind when working with files this size in
order to ensure optimal performance?

Thanks

In case of text it seems that you are using AcroForms and you can use
a similar approach for images.

PDF forms fields are associated with widget annotations. A widget
annotation can be associated with a custom appearance that can be an
image, text, or any type of PDF content.

Assuming that your PDF form has a 'button' field and you want to
change the appearance of this field you can create a custom form
appearance (based on the new image) and use it with
annot.SetAppearance(form). For details please see the following
articles:

http://groups.google.com/group/pdfnet-sdk/t/ab9d5f99e2a3996c
http://groups.google.com/group/pdfnet-sdk/t/91848554210740fc
http://groups.google.com/group/pdfnet-sdk/t/81334e0c79686c43
http://groups.google.com/group/pdfnet-sdk/t/848824466be878ae
http://groups.google.com/group/pdfnet-sdk/t/f3d0188670bc54f1
http://groups.google.com/group/pdfnet-sdk/t/e94b7d291796974

You can also use PDFNet API to replace images that are referenced
directly within PDF page content stream (using
pdfdoc.GetSDFDoc().Swap(image_a.GetSDFObj().GetObjNum(),
image_b.GetSDFObj().GetObjNum())) but given that you are using
AcroForms to fill-in a template, the above approach may be a better
option.