  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | -none- | -none- 2007-08-21 - By Leonard Rosenthol
Back You need to do your form filling BEFORE the PDF is "Reader Enabled".
Leonard
On Aug 21, 2007, at 3:43 PM, Robert Cearley wrote:
> > In adobe professional 8.0, there is a setting called: Enable Usage > rights in adobe reader. This setting allows you to create a pdf > document so a person can enter data into the pdf and save it. > > If I populate the pdf document using the setnodetext method below, > the populate method works; however, the document seems to lose the > ability for a user to type in data into the document and resave it. > > Here's what I'm trying to do. The code below will populate some > basic fields on a pdf. The pdf will be sent to a user that will > add additional text in the pdf. He will save the pdf with the data > he entered; however, the save option is lost. Any ideas? > > > Sample code: > > > PdfReader reader = new PdfReader(sourcefilename); > stamp = new PdfStamper(reader, File.Create(base.NewFileName)); > AcroFields form = stamp.AcroFields; > XfaForm xfaForm = form.Xfa; > XmlNode internalIdNode; > > internalIdNode = xfaForm.FindDatasetsNode("firstname"); > xfaForm.SetNodeText(internalIdNode, "john doe"); > > stamp.FormFlattening = false ; > stamp.Close(); > > Thanks... > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- > --- > 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 > iText-questions@(protected) > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/
<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line -break: after-white-space; ">You need to do your form filling BEFORE the PDF is "Reader Enabled".<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Leonard< /DIV><DIV><BR><DIV><DIV>On Aug 21, 2007, at 3:43 PM, Robert Cearley wrote:</DIV> <BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN style="FONT -SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso -spacerun: yes"> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout -grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso -no-proof: yes"><FONT size="2"></FONT></SPAN>?</DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE : 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">In adobe professional 8.0, there is a setting called: Enable Usage rights in adobe reader.? </FONT></SPAN><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">This setting allows you to create a pdf document so a person can?enter data?into?the pdf?and save it.? </FONT> </SPAN>< /DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2"></FONT></SPAN>?</DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT -FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">If I populate the pdf document using the setnodetext method below, the populate method works; however , the document seems to lose the ability for a user to type in data into the document and resave it.? </FONT></SPAN></DIV> <DIV class="MsoNormal" style= "MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2"></FONT></SPAN>?< /DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">Here's what I'm trying to do.? The code below will populate some basic fields on a pdf.? The pdf will be sent to a user that will?add additional text in the pdf.?He will save the pdf with the data he entered; however, the save option is lost.??Any ideas?? </FONT></SPAN></DIV> <DIV class= "MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style ="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2"> </FONT></SPAN>?</DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso -layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New '; mso-no-proof: yes"><FONT size="2"></FONT></SPAN>?</DIV> <DIV class="MsoNormal " style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT -SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">Sample code:</FONT></SPAN><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso -no-proof: yes"> ?</SPAN></DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"></SPAN>?</DIV> <DIV class="MsoNormal" style= "MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 5pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"></SPAN>?</DIV><DIV style="margin -top: 0in; margin-right: 0in; margin-bottom: 0pt; margin-left: 0in; "><FONT size ="2"><SPAN style="COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes" >PdfReader</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> reader = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af" >PdfReader</SPAN>(sourcefilename);</SPAN></FONT></DIV><DIV style="margin-top: 0in; margin-right: 0in; margin-bottom: 0pt; margin-left: 0in; "><SPAN style= "FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">stamp = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af"> PdfStamper</SPAN> (reader, <SPAN style="COLOR: #2b91af">File</SPAN>.Create(<SPAN style="COLOR: blue">base</SPAN>.NewFileName));</FONT></SPAN></DIV><DIV style="margin-top: 0in ; margin-right: 0in; margin-bottom: 0pt; margin-left: 0in; "><FONT size="2"> <SPAN style="COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes" >AcroFields</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> form = stamp.AcroFields;</SPAN></FONT></DIV><DIV style="margin-top: 0in; margin -right: 0in; margin-bottom: 0pt; margin-left: 0in; "><FONT size="2"><SPAN style= "COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">XfaForm</SPAN> <SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> xfaForm = form.Xfa; </SPAN></FONT></DIV><DIV style="margin-top: 0in; margin-right: 0in; margin -bottom: 0pt; margin-left: 0in; "><FONT size="2"><SPAN style="COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">XmlNode</SPAN><SPAN style="FONT -FAMILY: 'Courier New'; mso-no-proof: yes"> internalIdNode;</SPAN></FONT></DIV> <P class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> <SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">?< /FONT></SPAN></P><DIV style="margin-top: 0in; margin-right: 0in; margin-bottom: 0pt; margin-left: 0in; "><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">internalIdNode = xfaForm.FindDatasetsNode("firstname");< /FONT> </SPAN></DIV><DIV style="margin-top: 0in; margin-right: 0in; margin -bottom: 0pt; margin-left: 0in; "><SPAN style="FONT-FAMILY: 'Courier New'; mso -no-proof: yes"><FONT size="2">xfaForm.SetNodeText(internalIdNode, "john doe"); <SPAN style="mso-spacerun: yes"> ????? </SPAN><SPAN style="mso-spacerun: yes">?? ??????????????????????</SPAN></FONT></SPAN></DIV><P class="MsoNormal" style= "MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">?</FONT></SPAN></P><DIV style= "margin-top: 0in; margin-right: 0in; margin-bottom: 0pt; margin-left: 0in; "> <SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2">stamp .FormFlattening = <SPAN style="COLOR: blue">false</SPAN> ;<SPAN style="mso -spacerun: yes">??????????????? </SPAN><SPAN style="mso-spacerun: yes">????????? ???????</SPAN></FONT></SPAN></DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 'Courier New'; mso -no-proof: yes"><FONT size="2">stamp.Close();<SPAN style="mso-spacerun: yes">??? ???????????? </SPAN></FONT></SPAN></DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2"><SPAN style="mso-spacerun: yes"></SPAN> </FONT></SPAN>?</DIV> <DIV class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso -layout-grid-align: none"><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT size="2"><SPAN style="mso-spacerun: yes">Thanks...</SPAN></FONT>< /SPAN> </DIV></SPAN></SPAN><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- ---- ---- ---- ---- ---- ---- ------ -- ---- ---- ---- ---- ---- ------</DIV><DIV style="margin-top: 0px; margin -right: 0px; margin-bottom: 0px; margin-left: 0px; ">This SF.net email is sponsored by: Splunk Inc.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Still grepping through log files to find problems?<SPAN class="Apple-converted-space">? </SPAN>Stop.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px ; ">Now Search log events and configuration files using AJAX and a browser.</DIV ><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left : 0px; ">Download your FREE copy of Splunk now >><SPAN class="Apple -converted-space">? </SPAN><A href="http://get.splunk.com/__ ____ ____ ____ ____ __ ____ ____ ____ ____ __">http://get.splunk.com/__ ____ ____ ____ ____ ____ ___ __ ____ ____ ___</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin -bottom: 0px; margin-left: 0px; ">iText-questions mailing list</DIV><DIV style= "margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:iText-questions@(protected)">iText-questions@(protected) .sourceforge.net</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin -bottom: 0px; margin-left: 0px; "><A href="https://lists.sourceforge.net/lists /listinfo/itext-questions">https://lists.sourceforge.net/lists/listinfo/itext -questions</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin -bottom: 0px; margin-left: 0px; ">Buy the iText book: <A href="http://itext .ugent.be/itext-in-action/">http://itext.ugent.be/itext-in-action/</A></DIV> < /BLOCKQUOTE></DIV><BR></DIV></BODY></HTML> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- 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 iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|
 |