On Fri, 2009-08-07 at 05:10 +0000, 李康茂 wrote:

> Hi:
> 
> There is a sample PDF in attachment. Error msg: The PDF file is
> encrypted, and An error 28 ocurred during processing the pdf file.


Here's the full error message, which you should've seen as part of the
error you reported:

PoDoFo encounter an error. Error: 29 ePdfError_InvalidEncryptionDict
Error Description: The encryption dictionary is invalid or misses a
required key.
Callstack:
#0 Error Source: /home/craig/build/podofo/src/PdfParser.cpp:200
Information: Unable to load objects from file.
#1 Error Source: /home/craig/build/podofo/src/PdfParser.cpp:969
Information: The encryption entry in the trailer is neither an object
nor a reference.


See how it's saying "The encryption entry in the trailer is neither an
object nor a reference." 

If you have a look in the PDF's trailer dictionary, you'll see:

trailer
<<
/Size
208
/Info
86 0 R
/Encrypt
null
/Root
95 0 R
/Prev
528091
/ID
[
<4cfae179688af83987d7e9c39a3557b2>
<4cfae179688af83987d7e9c39a3557b2>
]
>>


See "/Encrypt null" ? That's the issue. Right now, PoDoFo treats the
presence of a /Encrypt key with a null instead of a reference to an
encryption dictionary or a direct encryption dictionary to be an error.

I'll have a look at the PDF reference to see if it's legal to have
a /Encrypt key with a null value. We should probably accept it and
ignore it even if it's not allowed by the spec, though.

By the way, that PDF has a few interesting spec deviations. The program
that produced it doesn't follow the rules for creating PDF particularly
well.


> 
> In addition, I want to ask you a question: How to support chinese PDF
> content parsing by means of using podofotxtextract tool. Thanks!
> 

Not sure yet. It'll depend a lot on how the text is represented in the
PDF - is it unicode, or another encoding? Is it dependent on weird
fonts? etc.

I expect that in sane cases where it uses unicode fonts or fonts with
standard encodings it wouldn't be  troublesome at all. In fact, I'd
expect it to already work, though I haven't looked into how
pdftxtextract handles text encodings so I might be wrong.

--
Craig Ringer
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to