[poppler] poppler/glib: poppler-document.cc, 1.6, 1.7 poppler-document.h, 1.6, 1.7 poppler-page.cc, 1.12, 1.13 poppler-page.h, 1.9, 1.10 poppler-private.h, 1.3, 1.4

Kristian Hogsberg krh at freedesktop.org
Thu Apr 7 15:01:53 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv29922/glib

Modified Files:
	poppler-document.cc poppler-document.h poppler-page.cc 
	poppler-page.h poppler-private.h 
Log Message:
2005-04-07  Kristian Høgsberg  <krh at redhat.com>

        * glib/poppler-document.cc:
        * glib/poppler-document.h:
        * glib/poppler-page.cc:
        * glib/poppler-page.h:
        * glib/poppler-private.h: Print to PS support from Marco Pesenti
        Gritti.



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- poppler-document.cc	30 Mar 2005 04:04:53 -0000	1.6
+++ poppler-document.cc	7 Apr 2005 22:01:51 -0000	1.7
@@ -395,3 +395,48 @@
 	g_free (iter);
 	
 }
+
+/**
+ * poppler_ps_file_new:
+ * @document: a #PopplerDocument
+ * @filename: the path of the output filename
+ * @n_pages: the total number of pages that will be rendered
+ * 
+ * Create a new postscript file to render to
+ * 
+ * Return value: a PopplerPSFile 
+ **/
+PopplerPSFile *
+poppler_ps_file_new (PopplerDocument *document, const char *filename, int n_pages)
+{
+	PopplerPSFile *ps_file;
+
+	g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
+	g_return_val_if_fail (filename != NULL, NULL);
+	g_return_val_if_fail (n_pages > 0, NULL);
+
+	ps_file = g_new0 (PopplerPSFile, 1);
+	ps_file->document = (PopplerDocument *) g_object_ref (document);
+	ps_file->out = new PSOutputDev ((char *)filename, document->doc->getXRef(),
+					document->doc->getCatalog(), 1,
+					n_pages, psModePS);
+
+	return ps_file;
+}
+
+/**
+ * poppler_ps_file_free:
+ * @ps_file: a PopplerPSFile
+ * 
+ * Free a PopplerPSFile
+ * 
+ **/
+void
+poppler_ps_file_free (PopplerPSFile *ps_file)
+{
+	g_return_if_fail (ps_file != NULL);
+
+	delete ps_file->out;
+	g_object_unref (ps_file->document);
+	g_free (ps_file);
+}

Index: poppler-document.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- poppler-document.h	30 Mar 2005 04:04:53 -0000	1.6
+++ poppler-document.h	7 Apr 2005 22:01:51 -0000	1.7
@@ -33,6 +33,7 @@
 typedef struct _PopplerDocument PopplerDocument;
 typedef struct _PopplerIndexIter PopplerIndexIter;
 typedef struct _PopplerPage PopplerPage;
+typedef struct _PopplerPSFile PopplerPSFile;
 
 PopplerDocument *poppler_document_new_from_file     (const char       *uri,
 						     const char       *password,
@@ -55,8 +56,11 @@
 gboolean          poppler_index_iter_next       (PopplerIndexIter  *iter);
 void              poppler_index_iter_free       (PopplerIndexIter  *iter);
 
-
-
+/* Export to ps */
+PopplerPSFile *poppler_ps_file_new   (PopplerDocument *document,
+				      const char      *filename,
+				      int              n_pages);
+void           poppler_ps_file_free  (PopplerPSFile   *ps_file);
 
 G_END_DECLS
 

Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- poppler-page.cc	5 Apr 2005 17:46:44 -0000	1.12
+++ poppler-page.cc	7 Apr 2005 22:01:51 -0000	1.13
@@ -431,6 +431,25 @@
   return g_list_reverse (matches);
 }
 
+/**
+ * poppler_page_render_to_ps:
+ * @page: a #PopplerPage
+ * @ps_file: the PopplerPSFile to render to
+ * 
+ * Render the page on a postscript file
+ * 
+ **/
+void
+poppler_page_render_to_ps (PopplerPage   *page,
+			   PopplerPSFile *ps_file)
+{
+  g_return_if_fail (POPPLER_IS_PAGE (page));
+  g_return_if_fail (ps_file != NULL);
+
+  ps_file->document->doc->displayPage (ps_file->out, page->index + 1,
+				       72.0, 72.0, 0, gTrue, gFalse);
+}
+
 static void
 poppler_page_get_property (GObject *object,
 			   guint prop_id,

Index: poppler-page.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- poppler-page.h	4 Apr 2005 21:50:56 -0000	1.9
+++ poppler-page.h	7 Apr 2005 22:01:51 -0000	1.10
@@ -31,25 +31,27 @@
 
 
 GType      poppler_page_get_type         (void) G_GNUC_CONST;
-void       poppler_page_render_to_pixbuf   (PopplerPage *page,
-					    int          src_x,
-					    int          src_y,
-					    int          src_width,
-					    int          src_height,
-					    double       scale,
-					    GdkPixbuf   *pixbuf,
-					    int          dest_x,
-					    int          dest_y);
-void       poppler_page_get_size           (PopplerPage *page,
-					    double      *width,
-					    double      *height);
-int        poppler_page_get_index          (PopplerPage *page);
-GdkPixbuf *poppler_page_get_thumbnail      (PopplerPage *page);
-gboolean   poppler_page_get_thumbnail_size (PopplerPage *page,
-					    int         *width,
-					    int         *height);
-GList     *poppler_page_find_text          (PopplerPage  *page,
-					    const  char  *text);
+void       poppler_page_render_to_pixbuf   (PopplerPage   *page,
+					    int            src_x,
+					    int            src_y,
+					    int            src_width,
+					    int            src_height,
+					    double         scale,
+					    GdkPixbuf     *pixbuf,
+					    int            dest_x,
+					    int            dest_y);
+void       poppler_page_get_size           (PopplerPage   *page,
+					    double        *width,
+					    double        *height);
+int        poppler_page_get_index          (PopplerPage   *page);
+GdkPixbuf *poppler_page_get_thumbnail      (PopplerPage   *page);
+gboolean   poppler_page_get_thumbnail_size (PopplerPage   *page,
+					    int           *width,
+					    int           *height);
+GList     *poppler_page_find_text          (PopplerPage   *page,
+					    const  char   *text);
+void	   poppler_page_render_to_ps	   (PopplerPage   *page,
+					    PopplerPSFile *ps_file);
 
 /* A rectangle on a page, with coordinates in PDF points. */
 typedef struct

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- poppler-private.h	30 Mar 2005 04:04:53 -0000	1.3
+++ poppler-private.h	7 Apr 2005 22:01:51 -0000	1.4
@@ -2,6 +2,7 @@
 #define __POPPLER_PRIVATE_H__
 
 #include <PDFDoc.h>
+#include <PSOutputDev.h>
 #include <Link.h>
 
 struct _PopplerDocument
@@ -10,6 +11,12 @@
   PDFDoc *doc;
 };
 
+struct _PopplerPSFile
+{
+  PopplerDocument *document;
+  PSOutputDev *out;
+};
+
 struct _PopplerPage
 {
   GObject parent_instance;



More information about the poppler mailing list