Urgh. I don't think so. iText's crypto support boils down to:
"Did you open it with the OWNER password? No? Then we won't touch it!"
That may only be for stamper though... lemme check. According to my
interpretation of the code, as long as you're sticking to PdfReader,
you're fine. It's PdfStamper that throws when you don't use the owner
password (and presumably Pdf*Copy*, but I didn't check them).
So you're fine. I think.
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
________________________________
From: King Goldman [mailto:[email protected]]
Sent: Wednesday, February 09, 2011 9:28 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] comparing pdf files
Will this solution work if my document is encrypted but not
password protected, ie
if my documents are immutable and not password protected can i
still load their field
value pairs?
Thanks for you quick reply
On Wed, Feb 9, 2011 at 11:18 AM, Mark Storer
<[email protected]> wrote:
If you just want to compare form field values, that's
not particularly hard. You should be able to simply load all the field
name/value pairs into maps and .equals() them. Something like:
public bool formsEqual(PdfReader reader1, PdfReader
reader1) {
AcroFields fields1 = reader1.getFields();
AcroFields fields2 = reader2.getFields();
Map<String, String> fieldMap1 = new HashMap<String,
String>();
Map<String, String> fieldMap2 = new HashMap<String,
String>();
Set<String> fieldNames =
fields1.getFields().keySet();
// if the number of fields differ, they're not
equal.
if (fieldNames.size() != fields2.getFields().size())
{
return false;
}
for (String name : fieldNames) {
fieldMap1.put(name, fields1.getField(name));
fieldMap2.put(name, fields2.getField(name));
}
// if the field values differ, they're not equal
return fieldMap1.equals(fieldMap2);
}
Is that what you had in mind? You could spruce that up
with logging... say within the for loop you could dump the field name
and both values to Standard Out every time the two field values differ.
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
________________________________
From: King Goldman
[mailto:[email protected]]
Sent: Tuesday, February 08, 2011 6:19 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] comparing pdf
files
I am trying to compare the data written to these
pdf files.
I am writing some data to a pdf file and i want
to compare the
data written to the fields in the pdf file if
they are correct.
For example, the date, name, address etc
On Tue, Feb 8, 2011 at 2:06 PM, Mark Storer
<[email protected]> wrote:
Not really, no. Two files that are
visually identical can be radically different under the hood, and two
files that are nearly identical byte-wise can be quite different
visually.
What about the files are you trying to
compare?
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
________________________________
From: King Goldman
[mailto:[email protected]]
Sent: Tuesday, February 08, 2011 10:59
AM
To:
[email protected]
Subject: [iText-questions] comparing pdf
files
Hi All,
Can you give me a good tool or a process
which will help me
compare two pdfs
Thanks
King
------------------------------------------------------------------------
------
The ultimate all-in-one performance
toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors
before they happen.
Find and fix more than 250 security
defects in the development cycle.
Locate bottlenecks in serial and
parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can
(and will) be answered with a reference to the iText book:
http://www.itextpdf.com/book/
Please check the keywords list before
you ask for examples: http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------
------
The ultimate all-in-one performance toolkit: Intel(R)
Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the
development cycle.
Locate bottlenecks in serial and parallel code that
limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be
answered with a reference to the iText book:
http://www.itextpdf.com/book/
Please check the keywords list before you ask for
examples: http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php