Copy link to clipboard
Copied
When I use Acrobat Pro DC to add an image field, the property page shows it is a button and not working like the image field in LiveCycle Designer which can load the image files dynamically.
Copy link to clipboard
Copied
Exit the form edit mode and click on the button.
Info: Acrobat and Designer creates different form types.
Copy link to clipboard
Copied
Exit the form edit mode and click on the button.
Info: Acrobat and Designer creates different form types.
Copy link to clipboard
Copied
Thanks for the info. Is there a way to fill the image field dynamically via the .net codes?
Copy link to clipboard
Copied
Acrobat uses Javascript. Look at the Action of the image field.
Copy link to clipboard
Copied
Thanks. Any sample codes for example?
Copy link to clipboard
Copied
We have a local image directory to keep different logo images with the user's ID as the image names. We want to load the logo based on the user who is using the form dynamically. Can AcroFom do that?
Thanks in advance.
Copy link to clipboard
Copied
Yes, but you would have to install a script on the local computer of each user for it to work.
And of course you will have to know the full-path of the image files in advance.
Copy link to clipboard
Copied
Great, any sample codes please.
Copy link to clipboard
Copied
Hi, I wrote the script and get it working on Adobe Pro DC but it is not working on Reader DC. do you know why?
thanks,
Michael
Copy link to clipboard
Copied
I don't know what script you use.
Copy link to clipboard
Copied
it is a fold level javascript like below
mySaveAs1 = app.trustPropagatorFunction(function(doc,path) {
app.beginPriv();
var f = doc.getField("ONPLLogo");
if (f.buttonImportIcon(path) == 0){
f.buttonImportIcon(path);
}
app.endPriv();
})
Copy link to clipboard
Copied
@michaelw888 Did you check the Acrobat JavaScript Reference for this entry? It clearly states that the field.buttonImportIcon() function is not available in Acrobat Reader.
Copy link to clipboard
Copied
Hi Thom,
Thanks for the info. So there is no way to show the icon in Reader DC, correct or there is other funtion to do it?
Thanks,
Michael
Copy link to clipboard
Copied
FYI, another expert try67 in this community has tested my codes and found it might be a bug in Reader DC.
Copy link to clipboard
Copied
Adobe is not obligated to do anything that is not explicitly covered in the official documentation. Nor do they tell us their plans. That said, the actual functionality of any particular function or property often strays from the spec.
I've been at this for more than 20 years, in that time the compatibility of the field.buttonImportIcon() function has changed dramatically. Sometimes it works in Reader and sometimes it doesn't. You are much better off relying on the official documentation than the odd functionality that works outside the spec.
So no, there is no bug with this function in Reader because as I previously stated, it explicitly states in the reference that this function is not available in Reader.
However, there is one thing you could try. Convert your image to a PDF and use that as the imported button icon. PDFs do not require any image conversion. This has worked in the past in Reader.
Also try not including the "cPath" parameter, so that Reader displays a file open dialog. This bypasses the security issues.
Copy link to clipboard
Copied
Thanks Thom!
As for your comments "However, there is one thing you could try. Convert your image to a PDF and use that as the imported button icon. PDFs do not require any image conversion. This has worked in the past in Reader.", do you mean use this way on the form level instead of folder -level script?
Thanks,
Michael
Copy link to clipboard
Copied
Or any example file for me to have a look?
Thanks
Copy link to clipboard
Copied
It doesn't matter. Not including the path will allow the function to be used in a document context. Converting the image to PDF has no affect on whether the function is used in a trusted function or not. The "no image conversion" bit is important because Reader doesn't do image conversion.
Copy link to clipboard
Copied
But how do I save a small icon image to be a pdf as it will be a full page. When choose it after the prompt, it shows a full pdf page with a tiny image.
Thanks,
Michael
Copy link to clipboard
Copied
NVM, I can print to PDF for the image. But if there is no path, the prompt is always to show up for the file to be loaded. Is there any way to autoload the image pdf when a form with the image button is opened without this prompt?
Thanks,
Michael
Copy link to clipboard
Copied
Try67 said the below about your comments in this matter.
"I believe that's no longer true, but will need to verify it. If so, it's very odd, since you can do it manually by clicking an image field."
Copy link to clipboard
Copied
Instead of printing to PDF, open the image file in Acrobat Pro, so that it does the conversion. If it's too large after conversion, use the crop tool in the PDF Edit toolset.
Copy link to clipboard
Copied
Hi Thom, after conversion, the icon shows up automatically via the path from the fold level script now. That means field.buttonImportIcon() still working in Reader DC:)
thanks for all the help.
Michael
Copy link to clipboard
Copied
Really? So it wasn't an issue in the first place?
Copy link to clipboard
Copied
The issue is the icon was a gif file and not show on Reader DC, after conversion, it shows.
Michael