*Hi,
I found this question in the mailing list archive. Today I got the same problem.
My Button is only gray.
Is there any solution?
Thanks for your answers!
slforms
Beate* *Niendorf* *wrote*:
>Hi :)
>
>I've got a problem to set text on a button. I'm sure it's a simple
>problem because this is not the first button I create with itext ;)
>But I really can't see where is the fault :/
>This is how I create the button:
>
>PushbuttonField push = new PushbuttonField(stamp.getWriter(),new
>Rectangle(10 + xadd, pageHeight - 40, fieldwidth + xadd, pageHeight -
>80), buttonName + "text");
>push.setFontSize(12);
>push.setText(buttonName + " (Text)");
>push.setBackgroundColor(Color.LIGHT_GRAY);
>push.setBorderColor(Color.GRAY);
>push.setTextColor(Color.BLACK);
>log.debug("push name: "+push.getFieldName());
>log.debug("push text: "+push.getText());
>PdfFormField ff = push.getField();
>PdfAction ac = PdfAction.createSubmitForm(buttonUrl, null, 0);
>log.debug("action: " + buttonUrl);
>ff.setAction(ac);
>stamp.addAnnotation(ff, 1);
>
>The logging tells me everything is all right - but if I open the created
>PDF-File only the gray buttons are visible (no text on them and no
>"onclick"-Action).
>
>Looking forward to any response :)
>
I replaced the variables with actual values and tested with this code:
PdfReader reader = new PdfReader("test.pdf");
PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("new.pdf"));
PushbuttonField push = new PushbuttonField(stamp.getWriter(), new
Rectangle(100, 100, 200, 200), "buttontest");
push.setFontSize(12);
push.setText("TEST");
push.setBackgroundColor(Color.LIGHT_GRAY);
push.setBorderColor(Color.GRAY);
push.setTextColor(Color.BLACK);
PdfFormField ff = push.getField();
PdfAction ac = PdfAction.createSubmitForm("http://www.submit-site.com",
null, 0);
ff.setAction(ac);
stamp.addAnnotation(ff, 1);
stamp.close();
And I get a button on page one that is labelled 'TEST'.
I don't see any real difference between your example and mine.
Could you send me a small standalone example starting from my
code snippet that reproduces the problem?
br,
Bruno
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions