Beate Niendorf wrote:

Hi there,
I'm quite new to itext and I bounced into a little problem. I have a PDF-file with one page (a graphic) and I'd like to insert a page before.
This worked realy fine with PdfStampers "insertPage()-method".
Now I want to fill this new page with a button.
On the one hand I thought drawing the button with the moethod from PdfContentByte should work. But in this case I don't know how to attach an action to this button. On the other hand I thought this button should be an AcroField (FIELD_TYPE_PUSHBUTTON). But in this case I don't know how to attach a new Form to the Pdf. I learned how to read existing AcroFields and concatening two different forms - but this is not what I want. I'd like to create a comlete new one for this particular page.

More or less written from memory, I'd say you need
to do something like this:

PushbuttonField push = new PushbuttonField(
 stamper.getWriter(), new Rectangle(36, 700, 144, 736), "pushAction");
push.setBackgroundColor(Color.GRAY);
push.setBorderColor(Color.BLACK);
pushbutton.setAction(PdfAction.javaScript("app.alert('action')", stamper.getWriter()));
stamper.addAnnotation(push, 1);

br,
Bruno


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to