Hi,

> Am 11.10.2016 um 10:07 schrieb Gilad Denneboom <gilad.denneb...@gmail.com>:
> 
> 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?

yes it is - and I'm planning to add that if I find the time but I'm currently 
very limited.

If you'd like to share some of your code please do so - would be good to have a 
new ticket for that by then.

Maruan



> 
> On Tue, Oct 11, 2016 at 8:30 AM, Maruan Sahyoun <sahy...@fileaffairs.de>
> wrote:
> 
>> Hi Gilad,
>> 
>>> Am 10.10.2016 um 23:28 schrieb Gilad Denneboom <
>> gilad.denneb...@gmail.com>:
>>> 
>>> 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: users-unsubscr...@pdfbox.apache.org
>> For additional commands, e-mail: users-h...@pdfbox.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to