Bug 57131

Summary: [PATCH] poppler-glib doesn't direct poppler warnings into its own error handling mechanism
Product: poppler Reporter: Joel Uckelman <uckelman>
Component: glib frontendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED DUPLICATE QA Contact:
Severity: minor    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: forward poppler warnings through g_warning

Description Joel Uckelman 2012-11-14 21:00:28 UTC
If poppler_document_new_from_data() is fed a corrupt PDF, this output goes to stderr rather than being put to the GError* passed to it:

  Error: May not be a PDF file (continuing anyway)
  Error: PDF file is damaged - attempting to reconstruct xref table...
  Error: Couldn't find trailer dictionary
  Error: Couldn't read xref table
  Error: PDF file is damaged - attempting to reconstruct xref table...

In order to stop this output from going to stderr, one must use libpoppler's setErrorFunction() from Error.h, which is not part of the glib interface.

It would be better if either (1) the glib interface caught these warnings and returned them in the GError*, or (2) gave some indication in the documentation that one needs to set one's own error handler to do this.

I'm reporting this against poppler 0.18.4 on Fedora 17.
Comment 1 Jason Crain 2013-01-09 02:50:24 UTC
Created attachment 72699 [details] [review]
forward poppler warnings through g_warning

Would something like in this patch work?  This forwards poppler's error messages through glib's message logging.  Then messages can be captured through g_log_set_handler using "Poppler" for the domain.
Comment 2 Joel Uckelman 2013-01-17 22:25:04 UTC
(In reply to comment #1)
> Created attachment 72699 [details] [review] [review]
> forward poppler warnings through g_warning
> 
> Would something like in this patch work?  This forwards poppler's error
> messages through glib's message logging.  Then messages can be captured
> through g_log_set_handler using "Poppler" for the domain.

That would be great, thanks.
Comment 3 Pino Toscano 2014-07-06 10:39:04 UTC

*** This bug has been marked as a duplicate of bug 73269 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.