https://bugs.documentfoundation.org/show_bug.cgi?id=106057

--- Comment #13 from Kevin Suo <[email protected]> ---
Well, see below my observations (but without a solution at this moment):

sdext/source/pdfimport/pdfiadaptor.cxx PDFIRawAdaptor::importer (in line 291):
calls
/source/pdfimport/pdfiadaptor.cxx PDFIRawAdaptor::parse (in line 217)

which calls (in line 231):
sdext/source/pdfimport/wrappter/wrapper.cxx xpdf_ImportFromStream (in line
1182)

xpdf_ImportFromStream copied the pdf content to a temp file because the called
has passed in a file stream thus xInput.is() is true. I don't think it is
necessary to make such temp file - why not pass the url of the original PDF
file and then use the xpdf_ImportFromFile directly? This is a separate issue.

xpdf_ImportFromStream then calls:
sdext/source/pdfimport/wrappter/wrapper.cxx xpdf_ImportFromFile (in line 998)
which uses the temp file as the data source

xpdf_ImportFromFile then calls (in line 1020):
sdext/source/pdfimport/wrappter/wrapper.cxx checkEncryption (in line 891)
(Poppler has the check encryption functionnality, so why do we use our own
check encryption here? I think it is because we need to show a dialog to ask
for password if it is encrypted. But how about we ask poppler to check
encryption, and if poppler tells it is encrypted, then we provide the password
through stdin?)

checkEncryption then calls (in line 901):
sdext/source/pdfimport/pdfparse/pdfparse.cxx pdfparse::PDFReader::read (there
are two such function, one for win32 and another for the "else". I am confused
by those ifdef _WIN32 stuff, but for me on linux it is in line 608.
Interestingly, there is another #ifdef _WIN32 in this block, and my program
jumps to line 637 directly)

Take note for the aGrammar:
PDFGrammar< file_iterator<> > aGrammar( file_start );

pdfparse::PDFReader::read calls boost::spirit::classic::parse, which took
several seconds (maybe a performance issue here?) But there is no exception
here:

            boost::spirit::classic::parse( file_start,
                                  file_end,
                                  aGrammar,
                                  boost::spirit::classic::space_p );

Then, finally, in line 672 we get the nEntries:

    unsigned int nEntries = aGrammar.m_aObjectStack.size();

And it is 2 for this pdf which in turn does not set a pRet in line 679 block,
thus in xpdf_ImportFromFile it returned False.

I am not familiar with the boost::spirit::classic::parse staff, thus not sure
why the aGrammar.m_aObjectStack.size() is 2.

I don't think I can fix this. I am providing this just FYI.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to