Java Mailing List Archive

http://www.junlu.com/

Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-08-21       - By Robert Cearley

 Back
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...

<span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; 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: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2"></font></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2">In adobe professional 8.0, there is a setting called:
Enable Usage rights in adobe reader.&nbsp;
</font></span><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;;
mso-no-proof: yes"><font size="2">This setting allows you to create a pdf
document so a person can&nbsp;enter data&nbsp;into&nbsp;the pdf&nbsp;and save
it.&nbsp; </font>
</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2"></font></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; 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.&nbsp;
</font></span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2"></font></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2">Here&#39;s what I&#39;m trying to do.&nbsp; The code below
will populate some basic fields on a pdf.&nbsp; The pdf will be sent to a user
that will&nbsp;add additional text in the pdf.&nbsp;He will save the pdf with
the data he entered; however, the save option is lost.&nbsp;&nbsp;Any ideas?
&nbsp;
</font></span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2"></font></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2"></font></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"><font size="2">Sample code:</font></span><span style="FONT-SIZE: 5pt; FONT
-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">
&nbsp;</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"></span>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-SIZE: 5pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof:
yes"></span>&nbsp;</div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<font size="2"><span style="COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;;
mso-no-proof: yes">PdfReader</span><span style="FONT-FAMILY: &#39;Courier New&
#39;; mso-no-proof: yes">
reader = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af"
>PdfReader</span>(sourcefilename);</span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; 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></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<font size="2"><span style="COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;;
mso-no-proof: yes">AcroFields</span><span style="FONT-FAMILY: &#39;Courier New&
#39;; mso-no-proof: yes">
form = stamp.AcroFields;</span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<font size="2"><span style="COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;;
mso-no-proof: yes">XfaForm</span><span style="FONT-FAMILY: &#39;Courier New&#39
;; mso-no-proof: yes">
xfaForm = form.Xfa;</span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<font size="2"><span style="COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;;
mso-no-proof: yes">XmlNode</span><span style="FONT-FAMILY: &#39;Courier New&#39
;; mso-no-proof: yes">
internalIdNode;</span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">&nbsp;</font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">internalIdNode = xfaForm.FindDatasetsNode("firstname");</font>
</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">xfaForm.SetNodeText(internalIdNode, "john doe");<span style="mso-spacerun:
yes">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></span
></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">&nbsp;</font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none">
<span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">stamp.FormFlattening = <span style="COLOR: blue">false</span>
;<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso
-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2">stamp.Close();<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></font></span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2"><span style="mso-spacerun: yes"></span></font></span>&nbsp;</div>

<div class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"
><span style="FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><font size=
"2"><span style="mso-spacerun: yes">Thanks...</span></font></span>
</div></span></span>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
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/

©2008 junlu.com - Jax Systems, LLC, U.S.A.