Thank for the info, Maruan. I implemented some of what you've described already, and will try to do the rest next... Maybe this is a a good "feature" request for future versions?
On Tue, Oct 11, 2016 at 8:30 AM, Maruan Sahyoun <[email protected]> wrote: > Hi Gilad, > > > Am 10.10.2016 um 23:28 schrieb Gilad Denneboom < > [email protected]>: > > > > I posted this question to SO > > <http://stackoverflow.com/questions/39958843/how-to- > import-an-icon-to-a-button-field-in-a-pdf-using-pdfbox>, > > but thought I might get better traction here... > > > > I'm looking for a way to set the normal appearance of a button field in a > > PDF file to an image file, but am not finding any information about this > > process. The closest I could find was the opposite, ie how to extract an > > icon from a button field to a stand-alone image file, here: How can i > > extract image from button icon in PDF using Apache PDFBox? > > <http://stackoverflow.com/questions/33295483/how-can-i- > extract-image-from-button-icon-in-pdf-using-apache-pdfbox> > > currently PDFBox doesn't have a high level API to set that. The easiest is > to create a sample with Acrobat and recreate that. > > The basics steps are > > - load your image as a PDXObjectImage > - create a PDXObjectForm with the image as a resource entry > - put that into the /I key of the fields MK entry > > Now this gives you the "Design" part so Readers can use that to regenerate > the appearance stream. At that point in time the Icon is not yet visible as > it's not part of the appearance stream > > For the appearance stream > > - add the PDXObjectForm you created above to the Resouces Entry of the > appearance stream > - call the PDXObjectForm in the appearance stream with a transformation > matrix before to scale the PDXObjectForm to fit the buttons dimension. > > BR > Maruan > > > > > > > Thanks in advance! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

