Hi,

I have encountered issues while trying to read a badly formated PDF. 
This PDF is generated by a third party that I must support, so I cannot 
ignore the problem.

After some investigations, it seems the xref table is not ended by two 
end of line characters but only one. Because of that, the 
ReadXRefSubsection API doesn't behave correctly and wrong IDs are read.

To avoid such an issue, I have added a workaround. The idea is to read 
only until the last eol character. Here is the diff :

789,795d788
<         for(int i = PDF_XREF_ENTRY_SIZE - 1; i > 0; i--){
<             if((m_buffer.GetBuffer()[i] == 10 || 
m_buffer.GetBuffer()[i] == 13) &&
<                 i != PDF_XREF_ENTRY_SIZE - 1){
< m_device.Device()->Seek(-(PDF_XREF_ENTRY_SIZE - 1 - i), 
std::ios_base::cur);
<             }
<         }
<

This patch fixes my issue. I hope this will help other persons having 
the same problem.

Regards,



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to