Commit 14092aab authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

pdf: Do not use EvDocument API in get_info implementation

get_info might be called while the document is being loaded and the
EvDocument cache is not filled yet. Use only the poppler API to make
sure we get valid values. This fixes the page size always reported as
0x0 in the properties dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=711093
parent 73cd70a4
......@@ -795,12 +795,15 @@ pdf_document_get_info (EvDocument *document)
g_free (metadata);
}
info->n_pages = ev_document_get_n_pages (document);
info->n_pages = poppler_document_get_n_pages (PDF_DOCUMENT (document)->document);
if (info->n_pages > 0) {
ev_document_get_page_size (document, 0,
&(info->paper_width),
&(info->paper_height));
PopplerPage *poppler_page;
poppler_page = poppler_document_get_page (PDF_DOCUMENT (document)->document, 0);
poppler_page_get_size (poppler_page, &(info->paper_width), &(info->paper_height));
g_object_unref (poppler_page);
// Convert to mm.
info->paper_width = info->paper_width / 72.0f * 25.4f;
info->paper_height = info->paper_height / 72.0f * 25.4f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment