Can you elaborate your solution little more please. I have mentioned piece of
my code for ur reference. I have to change the background color of the
layer, when an event is triggered like if the option of a radio button
selected is 'Yes'. I am able to hide it by changing the state through java
script, Since there is a whitespace I either need to shrink and expand or
change the background color so that user will realize that the corresponding
question is disabled.
Your response to the same would be highly appreciated.
Thanks a lot
Swapna.
PdfLayer layer = new PdfLayer("questionLayer",writer);
layer.setName("questionLayer");
layer.setOn(true);
cb.beginLayer(layer);
PdfPTable checkboxFieldTable = new PdfPTable(1);
checkboxFieldTable.setWidthPercentage(100f);
checkboxFieldTable.setSpacingBefore(25f);
p = new Paragraph();
p.add(new Phrase("Sample Question 1");
PdfPCell checkboxText = new PdfPCell(p);
checkboxText.setPaddingBottom(10f);
checkboxText.setBorderColor(Color.white);
checkboxText.setBorder(Rectangle.NO_BORDER);
checkboxFieldTable.addCell(checkboxText);
document.add(checkboxFieldTable);
PdfPTable checkboxOptionsTable = new PdfPTable(3);
checkboxOptionsTable.setWidthPercentage(100f);
float[] relativeWidths = {5.0f,50.0f,45.0f};
checkboxOptionsTable.setWidths(relativeWidths);
PdfFormField multipleCheckbox = PdfFormField.createCheckBox(writer);
multipleCheckbox.setButton(PdfFormField.FF_MULTISELECT);
multipleCheckbox.setFieldName("Sample Question 1");
multipleCheckbox.setLayer(controlLayer);
PdfAppearance cbOff = cb.createAppearance(10, 10);
PdfAppearance cbOn = cb.createAppearance(10, 10);
cbOff.rectangle(1, 1, 8, 8);
cbOff.stroke();
cbOn.rectangle(1, 1, 8, 8);
cbOn.stroke();
cbOn.moveTo(1, 1);
cbOn.lineTo(9, 9);
cbOn.moveTo(1, 9);
cbOn.lineTo(9, 1);
cbOn.fillStroke();
laQuestionOptions =
questionBO.getAllQuestionOptions(questionDataVO.getQuestionId());
for (int j = 0; j<laQuestionOptions.size();j++){
PdfFormField multipleCheckbox1 = PdfFormField.createEmpty(writer);
multipleCheckbox1.setFieldName("Option"+j);
multipleCheckbox1.setLayer(layer);
multipleCheckbox1.setAppearanceState("Off");
multipleCheckbox1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off",
cbOff);
multipleCheckbox1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "On",
cbOn);
multipleCheckbox.addKid(multipleCheckbox1);
PdfPCell cell = new PdfPCell();
cell.setCellEvent(new
CheckboxFormField(writer,"Option"+j,multipleCheckbox1));
cell.setBorderColor(Color.white);
cell.setBorder(Rectangle.NO_BORDER);
checkboxOptionsTable.addCell(cell);
}
document.add(checkboxOptionsTable);
cb.endLayer();
Leonard Rosenthol wrote:
>
> Yes and no.
>
> If you create different backgrounds, then you can associate each with
> a layer (OCG) and then turn them on/off as you wish.
>
> Leonard
>
> On Oct 24, 2007, at 1:46 PM, swapna reddy wrote:
>
>> Hi
>>
>> I am hiding layers when an event is triggered. Layers has some free
>> text and different control types(like
>> checkbox,selectbox,textbox....).I would like to know if it is
>> possible to change the background color of the layers with
>> javascript? If so, I would appreciate if someone can suggest me how
>> to go abt it.
>>
>>
>> Thanks
>> Swapna.
>>
>> Get the freedom to save as many mails as you wish. Click here to
>> know how.
>> ----------------------------------------------------------------------
>> ---
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a
>> browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
--
View this message in context:
http://www.nabble.com/Javascript-on-Layers-tf4685541.html#a13413924
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/