Hi ,
I want to hidden a button in the pdf form, I get DomDocuement by XfaForm
getDomDocument(), and I traversal the docuement, get the button field and
add "presence" attribute, but the button not be hidden.
source:
PdfReader reader = new PdfReader("c:\\pdfform.pdf");
FileOutputStream out = new FileOutputStream("c:\\newpdfform.pdf");
PdfStamper stamper = new PdfStamper(reader, out);
XfaForm form = new XfaForm(reader);
org.w3c.dom.Node templateNode = form.getDomDocument().getFirstChild();
//travsal to get button field
.....
//set button node to fieldNode
org.w3c.dom.Node presenceAttr = fieldNode.getAttributes()
.getNamedItem("presence");
if ("true".equalsIgnoreCase(value)) {
// show this field
if (presenceAttr != null) {
presenceAttr.setNodeValue("visible");
}
} else if ("false".equalsIgnoreCase(value)) {
// hidden this field
if (presenceAttr != null) {
presenceAttr.setNodeValue("hidden");
} else {
org.w3c.dom.Element ele = (Element) fieldNode
.cloneNode(true);
ele.setAttribute("presence", "hidden");
org.w3c.dom.Node parentNode = fieldNode
.getParentNode();
parentNode.replaceChild(ele, fieldNode);
}
}
PdfWriter writer = stamper.getWriter();
form.setXfa(writer);
stamper.close();
reader();
when I open "newpdfform.pdf", I find the button not be hidden, but if I open
this file in lifecycle designer and this button field is hidden in the pdf
preview.
how should I do to hidden this button?
--
Best Regards
Ying-chu Xu
MSN:[EMAIL PROTECTED]
Skype:radondo2000
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
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/