Radio Buttons over multiple pages
- From: "M 501" <mope501 (at) hotmail.com>
- Date: Tue, 07 Feb 2006 15:39:10 +0000
Hello,
I try to generate acro forms dynamically.
I added a table with a PdfPCellEvent - Class. However, the problem is that
when I try to create radio buttons that are split over multiple pages but
belong to one radio group there is something wrong.
For example if I have 3 radio buttons where the first two are on page one
and the third one is on page two then only the first two get printed but not
the third one.
In addition the first two buttons are also printed on the second page, on
the same position as they are on page one. This two seem to be a duplicate
of the first two buttons because if I change their size with adobe acrobat
also the size of the first two buttons changes.
So my result looks like this:
page 1
|--------------|
|
|
| () radiobutton label 1 [1]
| () radiobutton label 2
|--------------|
page 2
|--------------|
| radiobutton label 3 [2]
|
| () [3]
| ()
|--------------|
[1] the first two are printed correctly
[2] the third radio button is not printed
[3] the first two radio buttons are printed again on page 2
My code where I create the radio buttons looks like this: (It gets called 3
times, which is correct). I use a map called generatedRadioGroups to store
the radio groups which already have been created.
public void cellLayout(PdfPCell cell, Rectangle position,
PdfContentByte[] canvases) {
System.out.println("filling radio element:: " + fieldName);
RadioCheckField radio = getRadioButton(writer, style, position,
checktype);
PdfFormField top = (PdfFormField) generatedRadioGroups.get(fieldName);
if (top == null) {
top = radio.getRadioGroup(false, false);
generatedRadioGroups.put(fieldName, top);
}
PdfFormField radioButton;
try {
radio.setFieldName(id);
if (((Boolean) style.get("hidden")).booleanValue()) {
radio.setOptions(TextField.HIDDEN);
}
radioButton = radio.getRadioField();
top.addKid(radioButton);
writer.addAnnotation(top);
} catch (IOException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions