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
Hi Leonard,

Thanks for your reply.  Is there any other way to save the document so the
settings are not lost - a possible hack or via XFA?  Here's the scenario.
We have a software system that has multiple pdf templates that users can
select to merge with their data.  They do a merge and then download the
merged document to enter additional data on their side.  Once they are done,
they mail the pdf document back to the server, and the server imports the
data they changed back into the database.

I was able to narrow it down to the following, which causes the same
problem.

string sourcefilename = @"c:\temp\saveenabled.pdf";
PdfReader reader = new PdfReader(sourcefilename);
PdfStamper stamp = new PdfStamper(reader, File.Create(
@"c:\temp\saveenabled1.pdf"));
stamp.Close();
When you open the document it says:  This document contained certain rights
to enable special features in adobe reader.  this document has been changed
since it was created and these rights are no longer valid.  please contact
the author for the original version of this document.



On 8/21/07, Leonard Rosenthol <leonardr@(protected)> wrote:
>
> 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/
>
>
>
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
> 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/
>
>

<div><font size="2">
<p>Hi Leonard,<br><br>Thanks for your reply.&nbsp;&nbsp;Is there any other way
to save the document so the settings are not lost - a possible hack or via XFA?
&nbsp; Here&#39;s the scenario.&nbsp; We have a software system that has
multiple pdf templates that users can select to merge with their data.&nbsp;
They do a merge and then download the merged document to enter additional&nbsp
;data on their side.&nbsp; Once they are done, they mail the pdf document back
to the server, and&nbsp;the server&nbsp;imports the data they changed back into
the database.&nbsp;
</p></font>
<p><font color="#0000ff" size="2">I was able to narrow it down to the following
, which causes the same problem.&nbsp; </font></p>
<p><font color="#0000ff" size="2">string</font><font size="2"> sourcefilename =
</font><font color="#a31515" size="2">@&quot;c:\temp\saveenabled.pdf&quot;<
/font><font size="2">;<br></font><font color="#2b91af" size="2">PdfReader
</font><font size="2"> reader = </font><font color="#0000ff" size="2">new</font
><font size="2"> </font><font color="#2b91af" size="2">PdfReader</font><font
size="2">(sourcefilename);<br></font><font color="#2b91af" size="2">
PdfStamper</font><font size="2"> stamp = </font><font color="#0000ff" size="2"
>new</font><font size="2"> </font><font color="#2b91af" size="2">PdfStamper<
/font><font size="2">(reader, </font><font color="#2b91af" size="2">
File</font><font size="2">.Create(</font><font color="#a31515" size="2">@&quot
;c:\temp\saveenabled1.pdf&quot;</font><font size="2">));<br></font><font size="2
">stamp.Close();</font></p></div>
<div>When you open the document it says:&nbsp; This document contained certain
rights to enable special features in adobe reader.&nbsp; this document has been
changed since it was created and these rights are no longer valid.&nbsp; please
contact the author for the original version of this document.
</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">On 8/21/07, <b class="gmail_sendername">Leonard
Rosenthol</b> &lt;<a href="mailto:leonardr@(protected)">leonardr@(protected)<
/a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0
.8ex; BORDER-LEFT: #ccc 1px solid">
<div style="WORD-WRAP: break-word">You need to do your form filling BEFORE the
PDF is &quot;Reader Enabled&quot;.
<div><br>&nbsp;</div>
<div>Leonard</div>
<div><br>
<div>
<div><span class="e" id="q_1148a0882dee4204_1">
<div>On Aug 21, 2007, at 3:43 PM, Robert Cearley wrote:</div><br></span></div>
<blockquote type="cite">
<div><span class="e" id="q_1148a0882dee4204_3"><span style="FONT-SIZE: 5pt">
<span>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"><
/font></span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><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 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 style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"><
/font></span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><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 style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"><
/font></span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><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 style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"><
/font></span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"><
/font></span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"><font size="2"
>Sample code:</font></span><span style="FONT-SIZE: 5pt"> &nbsp;</span></div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"></span>&nbsp;<
/div>
<div style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 5pt"></span>&nbsp;<
/div>
<div style="MARGIN: 0in 0in 0pt"><font size="2"><span style="COLOR: #2b91af"
>PdfReader</span><span> reader = <span style="COLOR: blue">new</span> <span
style="COLOR: #2b91af">PdfReader</span>(sourcefilename);</span></font>
</div>
<div style="MARGIN: 0in 0in 0pt"><span><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: 0in 0in 0pt"><font size="2"><span style="COLOR: #2b91af"
>AcroFields</span><span> form = stamp.AcroFields;</span></font></div>
<div style="MARGIN: 0in 0in 0pt"><font size="2"><span style="COLOR: #2b91af"
>XfaForm</span><span> xfaForm = form.Xfa;</span></font></div>
<div style="MARGIN: 0in 0in 0pt"><font size="2"><span style="COLOR: #2b91af"
>XmlNode</span><span> internalIdNode;</span></font></div>
<p style="MARGIN: 0in 0in 0pt"><span><font size="2">&nbsp;</font></span></p>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2">internalIdNode = xfaForm
.FindDatasetsNode(&quot;firstname&quot;);</font> </span></div>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2">xfaForm.SetNodeText
(internalIdNode, &quot;john doe&quot;);<span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <
/span><span>&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></div>
<p style="MARGIN: 0in 0in 0pt"><span><font size="2">&nbsp;</font></span></p>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2">stamp.FormFlattening =
<span style="COLOR: blue">false</span> ;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;</span></font></span></div>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2">stamp.Close();<span>&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; </span></font></span></div>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2"><span></span></font><
/span>&nbsp;</div>
<div style="MARGIN: 0in 0in 0pt"><span><font size="2"><span>Thanks...</span><
/font></span> </div></span></span></span></div>
<div style="MARGIN: 0px">-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
-- ---- ---- ------</div>
<div style="MARGIN: 0px">This SF.net email is sponsored by: Splunk Inc.</div>
<div style="MARGIN: 0px">Still grepping through log files to find problems?
<span>&nbsp; </span>Stop.</div>
<div style="MARGIN: 0px">Now Search log events and configuration files using
AJAX and a browser.</div>
<div style="MARGIN: 0px">Download your FREE copy of Splunk now &gt;&gt;<span>
&nbsp; </span><a onclick="return top.js.OpenExtLink(window,event,this)" href=
"http://get.splunk.com/__ ____ ____ ____ ____ ____ ____ ____ ____ ____" target="
_blank">
http://get.splunk.com/__ ____ ____ ____ ____ ____ ____ ____ ____ ____</a></div>
<div style="MARGIN: 0px">iText-questions mailing list</div>
<div style="MARGIN: 0px"><a onclick="return top.js.OpenExtLink(window,event
,this)" href="mailto:iText-questions@(protected)" target="_blank"
>iText-questions@(protected)</a></div>
<div style="MARGIN: 0px"><a onclick="return top.js.OpenExtLink(window,event
,this)" href="https://lists.sourceforge.net/lists/listinfo/itext-questions"
target="_blank">https://lists.sourceforge.net/lists/listinfo/itext-questions
</a></div>
<div style="MARGIN: 0px">Buy the iText book: <a onclick="return top.js
.OpenExtLink(window,event,this)" href="http://itext.ugent.be/itext-in-action/"
target="_blank">http://itext.ugent.be/itext-in-action/</a></div></blockquote>
</div><br>&nbsp;</div></div><br>-- ---- ---- ---- ---- ---- ---- ---- ---- ----
-- ---- ---- ---- ---- ---<br>This SF.net email is sponsored by: Splunk Inc.<br
>Still grepping through log files to find problems? &nbsp;Stop.<br>Now Search
log events and configuration files using AJAX and a browser.
<br>Download your FREE copy of Splunk now &gt;&gt; &nbsp;<a onclick="return top
.js.OpenExtLink(window,event,this)" href="http://get.splunk.com/" target="_blank
">http://get.splunk.com/</a><br>__ ____ ____ ____ ____ ____ ____ ____ ____ ____
<br>iText-questions mailing list<br><a onclick="return top.js.OpenExtLink
(window,event,this)" href="mailto:iText-questions@(protected)">iText
-questions@(protected)</a><br><a onclick="return top.js.OpenExtLink
(window,event,this)" href="https://lists.sourceforge.net/lists/listinfo/itext
-questions" target="_blank">
https://lists.sourceforge.net/lists/listinfo/itext-questions</a><br>Buy the
iText book: <a onclick="return top.js.OpenExtLink(window,event,this)" href=
"http://itext.ugent.be/itext-in-action/" target="_blank">http://itext.ugent.be
/itext-in-action/
</a><br><br></blockquote></div><br>

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