Bug 96884 - pdf fails to load with poppler_document_new_from_stream()
Summary: pdf fails to load with poppler_document_new_from_stream()
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: glib frontend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-10 19:06 UTC by Phillip Berndt
Modified: 2018-08-21 11:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Failing file (84.26 KB, application/pdf)
2016-10-18 07:39 UTC, Phillip Berndt
Details

Description Phillip Berndt 2016-07-10 19:06:55 UTC
The file

https://punpun.xyz/Xl6N.pdf

displays fine with Poppler 0.24.5 (from Mint stable / Ubuntu oldstable), but fails to load in the latest version.


This issue was originally reported here: https://github.com/phillipberndt/pqiv/issues/67
Comment 1 Thomas Freitag 2016-07-11 11:40:34 UTC
I tried it with 0.42.0 and with actual master (0.45.0), but I didn't get any problems, neither with okular nor with evince nor with any commandline tools:

thomas@w7-thomas:~/xpdfmerge/thread/poppler$ ./glib/demo/poppler-glib-demo bugzilla/96884.open/Xl6N.pdf
Document successfully loaded in 0,5080 seconds
thomas@w7-thomas:~/xpdfmerge/thread/poppler$ ./utils/pdftocairo -png -cropbox bugzilla/96884.open/Xl6N.pdf output/Xl6N
thomas@w7-thomas:~/xpdfmerge/thread/poppler$ ./utils/pdftoppm -png -cropbox bugzilla/96884.open/Xl6N.pdf output/Xl6N
Comment 2 Phillip Berndt 2016-07-11 12:01:02 UTC
Indeed, the demo works here as well. I dug a bit deeper into this and found that the error is in the poppler_document_new_from_stream() call of the glib interface.

Files opened via poppler_document_new_from_file() and poppler_document_new_from_data(), respectively, work fine.

This fails:

-----8<----------------------------

// gcc -o test test.c `pkg-config --libs --cflags glib-2.0 poppler-glib`
// to compile
#include <stdio.h>
#include <glib.h>
#include <poppler.h>

int main(int argc, char *argv[]) {
	GError *error_pointer = NULL;
	GFile *file = g_file_new_for_path(argv[1]);
	GFileInputStream *stream = g_file_read(file, NULL, &error_pointer);
	PopplerDocument *doc = poppler_document_new_from_stream(G_INPUT_STREAM(stream), -1, NULL, NULL, &error_pointer);

	if(error_pointer) {
		printf("Error: %s\n", error_pointer->message);
	}
}

----->8----------------------------
Comment 3 Phillip Berndt 2016-07-11 12:05:56 UTC
Ps. This also means that this is not a regression. In 0.24.5, poppler_document_new_from_stream() has actually been completely unusable due to bug #82630, and I had a workaround in place that does not use the API if the poppler version is too old. Sorry for the misinformation.
Comment 4 Phillip Berndt 2016-10-18 07:39:26 UTC
Created attachment 127373 [details]
Failing file

Here is another file, this time created by LaTeX and thus probably simpler in its structure, that fails to load with the stream loader.
Comment 5 GitLab Migration User 2018-08-21 11:03:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/488.


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.