[evince/gnome-3-10] pdf: Do not use EvDocument API in get_info implementation



commit 14092aab7c2c57becf045f3120297ab56ff76470
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Wed Oct 30 10:32:31 2013 +0100

    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

 backend/pdf/ev-poppler.cc |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index f4c63c7..c751768 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]