From: Carlos Garcia Campos Date: Sun, 5 Sep 2010 16:35:16 +0000 (+0200) Subject: [xps] Add support for printing XPS Documents X-Git-Tag: EVINCE_2_91_0~57 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=8ad7d34a6f7dda19b83e32f05f384927e30bb7ef;p=evince.git [xps] Add support for printing XPS Documents --- diff --git a/backend/xps/xps-document.c b/backend/xps/xps-document.c index 544742e0..4e290b0f 100644 --- a/backend/xps/xps-document.c +++ b/backend/xps/xps-document.c @@ -24,6 +24,7 @@ #include "xps-document.h" #include "ev-document-links.h" +#include "ev-document-print.h" #include "ev-document-misc.h" struct _XPSDocument { @@ -39,11 +40,14 @@ struct _XPSDocumentClass { }; static void xps_document_document_links_iface_init (EvDocumentLinksInterface *iface); +static void xps_document_document_print_iface_init (EvDocumentPrintInterface *iface); EV_BACKEND_REGISTER_WITH_CODE (XPSDocument, xps_document, { EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_LINKS, xps_document_document_links_iface_init); + EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_PRINT, + xps_document_document_print_iface_init); }) /* XPSDocument */ @@ -478,3 +482,25 @@ xps_document_document_links_iface_init (EvDocumentLinksInterface *iface) iface->find_link_dest = xps_document_links_find_link_dest; iface->find_link_page = xps_document_links_find_link_page; } + +/* EvDocumentPrint */ +static void +xps_document_print_print_page (EvDocumentPrint *document, + EvPage *page, + cairo_t *cr) +{ + GError *error = NULL; + + gxps_page_render (GXPS_PAGE (page->backend_page), cr, &error); + if (error) { + g_warning ("Error rendering page %d for printing: %s\n", + page->index, error->message); + g_error_free (error); + } +} + +static void +xps_document_document_print_iface_init (EvDocumentPrintInterface *iface) +{ + iface->print_page = xps_document_print_print_page; +}