Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Add/Set a form field button image.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 10.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.AddButtonImage"; PDF; Field; Button State; Caption; Image File Path )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Field The field index or field name. "FirstName"
Button State The state of the button.
Can be "Up", "Down" or "RollOver".
Caption The caption text. "Hello"
Image File Path The native file path for the image file. "C:\test\picture.png"


Returns OK or error.


Add/Set a form field button image.
Adds an image to a push button to one or more of the three different states of a button. The parameter Field must be handle of a button field that was returned by a DynaPDF.CreateButton function call or the index of an existing field of type button.
The parameter State defines the button state in which the image should appear. Each state is optional; it is possible to add different images to all three states of the button. The rollover state should get a different image than the other states. If two states should get the same image, the image is physically inserted only once to the PDF file.
DynaPDF checks whether duplicate images are already available before inserting an image again. Depending on the parameter UseTransparency (see DynaPDF.SetUseTransparency) the image appears with a transparent background or opaque (default transparent). However, note that the background of the button must be transparent too to get a transparent button. Otherwise the button is still opaque due the opaque background of the button.
The parameter Caption is optional, it can be empty. Each state can contain its own caption which is drawn horizontally and vertically centered by default. The alignment can be changed with the function SetFieldTextAlign(). Because each button state is directly drawn when calling the function, the alignment must be set before this function is called.
If a button has already an image for a specific button state, the existing image will be replaced with the new one.

See also AddButtonImage function in DynaPDF manual.

See also

Release notes

Blog Entries

This function checks for a license.

Created 17th April 2020, last changed 7th November 2021

DynaPDF.AddBookmarkEx - DynaPDF.AddButtonImageEx2

💬 Ask a question or report a problem