X-Git-Url: https://git.donarmstrong.com/?p=xournal.git;a=blobdiff_plain;f=src%2Fxo-file.c;h=7ff79749542b2dec4834df12d09d439cf6d970fa;hp=ad596201a0196fc15232769515cdd4547b445ac3;hb=b471a5e1ffc9ad87400f079679fdf261875d513e;hpb=4d39b1b77c637b56b4f094e39328b3394cefa4dc diff --git a/src/xo-file.c b/src/xo-file.c index ad59620..7ff7974 100644 --- a/src/xo-file.c +++ b/src/xo-file.c @@ -1116,6 +1116,7 @@ gboolean init_bgpdf(char *pdfname, gboolean create_pages, int file_domain) struct Page *pg; PopplerPage *pdfpage; gdouble width, height; + gchar *uri; if (bgpdf.status != STATUS_NOT_INIT) return FALSE; @@ -1135,8 +1136,17 @@ gboolean init_bgpdf(char *pdfname, gboolean create_pages, int file_domain) bgpdf.pid = 0; bgpdf.has_failed = FALSE; - bgpdf.document = poppler_document_new_from_data(bgpdf.file_contents, bgpdf.file_length, NULL, NULL); - if (bgpdf.document == NULL) shutdown_bgpdf(); +/* poppler_document_new_from_data() starts at 0.6.1, but we want to + be compatible with poppler 0.5.4 = latest in CentOS as of sept 2009 */ + uri = g_filename_to_uri(pdfname, NULL, NULL); + if (!uri) uri = g_strdup_printf("file://%s", pdfname); + bgpdf.document = poppler_document_new_from_file(uri, NULL, NULL); + g_free(uri); +/* with poppler 0.6.1 or later, can replace the above 4 lines by: + bgpdf.document = poppler_document_new_from_data(bgpdf.file_contents, + bgpdf.file_length, NULL, NULL); +*/ + if (bgpdf.document == NULL) { shutdown_bgpdf(); return FALSE; } if (pdfname[0]=='/' && ui.filename == NULL) { if (ui.default_path!=NULL) g_free(ui.default_path);