So here's what I did... I created in Acrobat a new PDF file with a button that has the icon I want to use. I load that file in my app and copy the AppearanceCharacteristics and NormalAppearance map from that button into variables. Then I create the button in my main file and apply these two objects to its widget. So far as good... I then save the mail file and close both of them. When I open the main file in Acrobat I can see the icon I've copied under the Properties of the button field, but it's not visible on the page itself. I also set "NeedAppearances" to TRUE, just for good measure, but it didn't help.
Any ideas? On Sun, Dec 13, 2015 at 8:10 PM, Maruan Sahyoun <[email protected]> wrote: > If you need additional information please let me know > > > > Am 13.12.2015 um 19:52 schrieb Gilad Denneboom < > [email protected]>: > > > > Thanks for the info, Maruan. I'll play around with it and see what I can > > come up with... > > > > On Sun, Dec 13, 2015 at 6:26 PM, Maruan Sahyoun <[email protected]> > > wrote: > > > >> Hi, > >> > >> you can do > >> > >> PDAnnotationWidget widget = field.getWidgets().get(0); > >> PDAppearanceDictionary apDictionary = widget.getAppearance(); > >> apDictionary.setNormalAppearance(PDAppearanceStream stream); > >> > >> Unfortunately for the appearance stream you are on you own as for the > >> exact look of a push button there are no details in the specification. > What > >> you could do is look at the appearance stream as Adobe generates is and > >> replicate it. > >> > >> Now if you know how the content should look like you can use > >> > >> PDPageContentStream(PDDocument doc, PDAppearanceStream appearance) > >> > >> which gives you a higher level API to add content to your appearance > >> stream. > >> > >> Hope that helps. > >> > >> BR > >> Maruan > >> > >> PS: I'm planning to add the ability to add some default appearances for > >> the different field types when adding new fields via PDFBox but will not > >> start before 2.0 has been released. > >> > >> > >>>> Am 12.12.2015 um 10:11 schrieb Gilad Denneboom < > >>> [email protected]>: > >>> > >>> Hi all, > >>> > >>> Using PDFBox 1.8.10 (or 2.0.0-RC2, whatever works), is there an option > to > >>> set the Normal Icon appearance stream of a push-button? I only see a > >> getter > >>> for this property, not a setter, and attempts to find information > online > >>> about how to achieve it have been unsuccessful. > >>> > >>> I would appreciate any tips or sample code that will help me solve this > >>> problem... > >>> > >>> Thanks in advance, Gilad. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

