Commit e79a8b94 authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-04-07 Kristian Høgsberg <krh@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.
parent 7319b66e
2005-04-07 Kristian Høgsberg <krh@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.
Thu Apr 7 12:25:39 2005 Jonathan Blandford <jrb@redhat.com>
* configure.ac: check for qt, not glib, when enabling the qt
......
......@@ -395,3 +395,48 @@ poppler_index_iter_free (PopplerIndexIter *iter)
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);
}
......@@ -33,6 +33,7 @@ G_BEGIN_DECLS
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 @@ PopplerAction *poppler_index_iter_get_action (PopplerIndexIter *iter);
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
......
......@@ -431,6 +431,25 @@ poppler_page_find_text (PopplerPage *page,
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,
......
......@@ -31,25 +31,27 @@ G_BEGIN_DECLS
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
......
......@@ -2,6 +2,7 @@
#define __POPPLER_PRIVATE_H__
#include <PDFDoc.h>
#include <PSOutputDev.h>
#include <Link.h>
struct _PopplerDocument
......@@ -10,6 +11,12 @@ struct _PopplerDocument
PDFDoc *doc;
};
struct _PopplerPSFile
{
PopplerDocument *document;
PSOutputDev *out;
};
struct _PopplerPage
{
GObject parent_instance;
......
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