Hi, I submitted this patch a while ago, but didn't get a response. In case it slipped through the cracks, I've pasted the text of the email below, and re-attached the patch file.
An issue I've run into is full failure of parsing when objects are referred to that don't exist. Often this is due to XRef stream entries that point to non-existent object streams or non-existent indices within those streams. This should be a recoverable error. There's a bool member `m_bIgnoreBrokenObjects` in `PdfParser`, and that member is exposed through `SetIgnoreBrokenObjects()`, but it's set to false in `Init()`, which is called by `Clear()`, which is called at the top of `ParseFile()`, so user-defined values are overwritten. Following the pattern used for the `m_bLoadOnDemand` flag, I've modified the `ParseFile()` functions to allow the user to pass in an optional `bIgnoreBrokenObjects` parameter (default false) to get around this issue. I've attached a patch to show what this looks like, and which also allows passing the `bIgnoreBrokenObjects` flag to `PdfMemDocument` constructors and `Load()` functions. It also checks the flag when reading objects from a stream. Is this the right way to go about this, or is there a better way to allow graceful failure and continuation of parsing? -- John Senneker ____________________________________________________________ Electronic mail messages entering and leaving Arup business systems are scanned for viruses and acceptability of content.
PoDoFo-ignore-broken-objects_updated.patch
Description: PoDoFo-ignore-broken-objects_updated.patch
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users