Note that this ISN'T the same error it gives when I get the password
wrong - on the files where this command works, if I get the password
wrong it says "OWNER PASSWORD REQUIRED, but not given (or incorrect)" -
so that isn't the problem with these files. And as I said I can open
the pdf in kpdf without problems, so I know the password is correct.
I also tried pdf2ps, but just got an "unrecoverable error":
pdf2ps -sPDFPassword=blah blah.pdf
Error: /ioerror in --.reusablestreamdecode--
Additional information: (\2113B\267\\'\006\b|'\006\b\fW\005\b\370\002)
Operand stack:
... and then a load of other stuff from the internals of ghostscript?
I saw a report where pdftk has a problem with umlauts in the filenames,
but this isn't the case here - I really did rename it to blah.pdf and
there are no funny characters in the path.
System: Mandriva linux, pdftk 1.41
Any clues? Thanks!
You (should) know that Pdftk is nothing more than a very old version of
iText (a Java-PDF library) compiled with GCJ and extended with some
command line functionality.
The keywords in the above statement are "VERY OLD". The iText version
that was used to create Pdftk only supported standard encryption
(Alleged RC4); it didn't support AES encryption (yet).
Maybe the PDFs causing you trouble are encrypted using the AES
algorithm. That would explain why you can open them with newer tools,
but not with the (discontinued?) Pdftk tool.
Why do I think Pdftk is discontinued? The last thing I heard from Sid
Steward (the developer responsible for Pdftk) is that he had inherited
his father's business and that he wouldn't work on Pdftk anymore.
As Pdftk has a huge dependency on iText, all other companies who'd like
to continue developing business using Pdftk should be in touch with
iText Software LLC: http://itextsoftware.com/
And iText Software LLC has no business relationship with any other
company with respect to Pdftk, so I assume there are no other companies
working on Pdftk.
You (should) know that Pdftk is nothing more than a very old version of
Bruno Lowagie wrote:
> ... The iText version
This is a copy paste of the encryption dictionary of a PDF encrypted
with AES encryption:
<<
/StrF/StdCF
/CF <<
/StdCF <<
/CFM/AESV2
/AuthEvent/DocOpen
/Length 16
>>
>>
/StmF/StdCF
/U (xxxxxx)
/O (xxxxxx)
>>
This is an example of the encryption dictionary of a PDF encrypted with
the Standard Encryption:
<<
/Length 128
/V 2
/P -1852
/Filter/Standard
/R 3
/U (xxxxxx)
/O (xxxxxx)
>>
Try finding the encryption dictionary in your PDFs.
Normally, you'll find a reference to the Encryption dictionary in the
catalog (root) of the PDF. Something like this: /Encrypt 7 0 R
But if I do the same with one of the pdfs which work, it doesn't contain
AES at all.
So you're right, it looks like it is the AES causing the problem, now is
there any other tool around which can handle these kinds of pdf?
Thanks!
Bruno Lowagie wrote:
> This is a copy paste of the encryption dictionary of a PDF encrypted
> with AES encryption:
...
Sorry, I only focus on iText and iText related products.
But you're probably not looking for a Java / C# solution.
You might try multivalent:
http://multivalent.sourceforge.net/Tools/pdf/Decrypt.html
--Tim Arnold
On Feb 22, 7:04 pm, firsttimelinux <firsttimeli...@yahoo.com> wrote:
> It looks like you're right - I opened it up in KHexedit and searched for
> AES, and found this:
> <</CF<</StdCF<</AuthEvent/DocOpen/CFM/AESV2/Length 16>>
>
> But if I do the same with one of the pdfs which work, it doesn't contain
> AES at all.
>
> So you're right, it looks like it is the AES causing the problem, now is
> there any other tool around which can handle these kinds of pdf?
Not free: http://www.coherentpdf.com/
cpdf in.pdf owner=mypassword -o out.pdf
I normally recommend pdftk for free stuff, so I've not looked further
than that.
ghostscript should be able to do it, though, by specifying the output
device as PDF and giving the password on the command line. Try "man
gs".
That Decrypt works for the ones which pdftk can handle, but fails for
the AES ones with the message: "invalid OWNER password". I hadn't quite
appreciated the difference between the owner and user passwords before.
I know the password for kpdf so I can read it, but it looks like I
don't know the owner password.
I also tried the "Merge" to join pdfs together (as I have done with
pdftk) but that fails for both kinds of pdf.
Oh well. :/
Anyway, fortunately I found the (or an) answer - and it was much easier
than I thought! I just opened the pdfs in kpdf, entered the password,
and then printed them to a new pdf file. Simple!
From then on the new file is unprotected so I can use pdftk to merge
them / whatever.
Problem solved! :)