Expand my Community achievements bar.

Load image from URL on file open, then embed image

Avatar

Level 1

(Continued from Load image from URL on file open, then embed image.)


I am trying to create a PDF form with an image field that is empty/blank by default. When the PDF is opened, I want it to load the image at C:\picture.jpg and embed that image in that document.

I need it to load on file open because C:\picture.jpg will be different each time the file is opened. Currently, if I set the image URL and embed it, it uses the image at the first time it's embedded.

I've attempted to create userInfo.js and placed it in my Javascripts folder. That file (adapted from How do I change an image in a button automatically without changing its location?):


myIcon = app.trustedFunction( function (){app.beginPriv();


this.getField("userInfo").buttonImportIcon("C:\\picture.jpg"


app.endPriv();})


I then added event.target.myIcon(event.target) to topmostSubform.Page1::initialize.


I get the following error when opening my pdf:


TypeError: this.getField("userInfo") is null

2:XFA:topmostSubform[0]:Page1[0]:initialize

I know the field is null. I want it to be null until I open the pdf. Is there another reason that error would be appearing?

0 Replies