GObject parent_instance;
PopplerDocument *document;
+ PopplerPSFile *ps_file;
gchar *password;
PdfDocumentSearch *search;
static void pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void pdf_document_document_links_iface_init (EvDocumentLinksIface *iface);
static void pdf_document_find_iface_init (EvDocumentFindIface *iface);
+static void pdf_document_ps_exporter_iface_init (EvPSExporterIface *iface);
static void pdf_document_thumbnails_get_dimensions (EvDocumentThumbnails *document_thumbnails,
gint page,
gint size,
pdf_document_document_links_iface_init);
G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FIND,
pdf_document_find_iface_init);
-#if 0
G_IMPLEMENT_INTERFACE (EV_TYPE_PS_EXPORTER,
pdf_document_ps_exporter_iface_init);
-#endif
});
-
-
-
-
static void
pdf_document_get_property (GObject *object,
guint prop_id,
iface->cancel = pdf_document_find_cancel;
}
+static void
+pdf_document_ps_exporter_begin (EvPSExporter *exporter, const char *filename)
+{
+ PdfDocument *pdf_document = PDF_DOCUMENT (exporter);
+ int n_pages;
+
+ n_pages = pdf_document_get_n_pages (EV_DOCUMENT (exporter));
+ pdf_document->ps_file = poppler_ps_file_new (pdf_document->document,
+ filename, n_pages);
+}
+
+static void
+pdf_document_ps_exporter_do_page (EvPSExporter *exporter, int page)
+{
+ PdfDocument *pdf_document = PDF_DOCUMENT (exporter);
+ PopplerPage *poppler_page;
+
+ g_return_if_fail (pdf_document->ps_file != NULL);
+
+ poppler_page = poppler_document_get_page (pdf_document->document, page);
+ poppler_page_render_to_ps (poppler_page, pdf_document->ps_file);
+}
+
+static void
+pdf_document_ps_exporter_end (EvPSExporter *exporter)
+{
+ PdfDocument *pdf_document = PDF_DOCUMENT (exporter);
+
+ poppler_ps_file_free (pdf_document->ps_file);
+ pdf_document->ps_file = NULL;
+}
+
+static void
+pdf_document_ps_exporter_iface_init (EvPSExporterIface *iface)
+{
+ iface->begin = pdf_document_ps_exporter_begin;
+ iface->do_page = pdf_document_ps_exporter_do_page;
+ iface->end = pdf_document_ps_exporter_end;
+}
PdfDocument *
pdf_document_new (void)
ev_ps_exporter_begin (EV_PS_EXPORTER (job->document),
job->temp_file);
g_mutex_unlock (EV_DOC_MUTEX);
- job->next_page = 1; /* FIXME use 0-based page numbering? */
+ job->next_page = 0;
job->printing = TRUE;
return TRUE;
}
page_cache = ev_document_get_page_cache (job->document);
- if (job->next_page <= ev_page_cache_get_n_pages (page_cache)) {
+ if (job->next_page < ev_page_cache_get_n_pages (page_cache)) {
#if 0
g_printerr ("Printing page %d\n", job->next_page);
#endif