Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] Setting a text value causes PDF to
 loseability to save data. "usage rights" setting is lost.

Paulo Soares

2007-08-21


Only Adobe products can set usage rights. You won't find it here or
elsewhere.

Paulo

----- Original Message -----
From: "Robert Cearley" <rcearley@(protected)>
To: "Post all your questions about iText here"
<itext-questions@(protected)>
Sent: Tuesday, August 21, 2007 9:35 PM
Subject: Re: [iText-questions] Setting a text value causes PDF to
loseability to save data. "usage rights" setting is lost.


> 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):
>>
>> 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/
©2008 junlu.com - Jax Systems, LLC, U.S.A.