I want to move a picture in a pdf in 3 possible specific locations.
I tried these:-
1) created a picture, by creating a button and setting an image button on it, but then i did not find commands to move the button
So if you could give me commands to move a button, that will be great.
I tried something else.
2) i put the button in all the locations but removed the icon from it, so it looks empty.
at run time i apply the image name on one of the 3 buttons, thus it looked like the button moves from one of the three locations to the other.
eg:-
button1.image="";
button2.image="img.jpg";
button3.image="";
thus it looks like the iamge moved from location 1 or 3 to 2.
i tried using this command to dynamically set the image of an icon which initially has no image, but it does not work
IAFormApp formApp;
IFields myFields = (IFields)formApp.Fields;
IEnumerator myEnumerator = myFields.GetEnumerator();
while (myEnumerator.MoveNext())
{
myField = (IField)myEnumerator.Current;
if (myField.Name=="btnPage4L")
myField.SetButtonIcon("",@"C:\ACK-SDK\colorrisk.jpg",4);
}
There is no documentation at all on the SetButtonIcon, not in the SDK and not on the internet.
No i think you got confused, "SetButtonIcon" is not javascript, this is the command available in the SDK, however the issue is:-
1) there is no documentation on it
2) there are no examples
3) the command gives an error
4) there is no info on it in the entire internet
it is strange, because i am getting "out of index range error", the only number used in the parameters is the last parameter which is page number, i gave numbers from -1 to all numbers, i still get the error.
i dont know what you mean by api and non-api. when i type MYFIELD., i get a drop down of command and SetButtonIcon() is one of them
look at the below code and let me know why it gives error?
IAFormApp formApp;
IFields myFields = (IFields)formApp.Fields;
IEnumerator myEnumerator = myFields.GetEnumerator();
while (myEnumerator.MoveNext())
{
myField = (IField)myEnumerator.Current;
if (myField.Name=="btnPage4L")
myField.SetButtonIcon("",@"C:\ACK-SDK\colorrisk.jpg",4);
}
Based on the code that you've posted, and your question, it sounds like
you've never read the documentation. The Acrobat API is not "discoverable",
you need to read the documentation that comes with it. Take a look at this
page -
http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/IAC_API_Fo rmsIntro.107.11.html
- it describes the SetButtonIcon function and it lists what the three
parameters are supposed to be. In your sample code, you are passing in an
empty string as the first parameter. That may work (I don't know if it
does), but even if it does, that would be undocumented behavior. You need
to supply one of the codes listed in the documentation. Also, the last
parameter is the page number that is retrieved from the PDF file to be used
as your button image. Even if you could use a JPEG file, the value "4"
would definitely be wrong.
So please read the documentation that comes with the API, it will save you
a lot of time and frustration.
Karl Heinz Kremer
PDF Acrobatics Without a Net
Karl,
yes it was the combination of 2 things, the first parameter has to be a code N or D or R
and the second is the image which must be a pdf and not jpg, LRosenth had mentioned that earlier
once i saw it was working i looked above and said "im ready, you can take me now, it is finished..."
amen ![]()
thank you all Karl, LRosenth, Bernd
North America
Europe, Middle East and Africa
Asia Pacific