summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 218b260)
raw | patch | inline | side by side (parent: 218b260)
author | bryce <bryce@users.sourceforge.net> | |
Mon, 31 Dec 2007 20:20:13 +0000 (20:20 +0000) | ||
committer | bryce <bryce@users.sourceforge.net> | |
Mon, 31 Dec 2007 20:20:13 +0000 (20:20 +0000) |
src/extension/internal/pdf-input-cairo.cpp | patch | blob | history |
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index 2b38481e12a6a0c28b92f8215dc1c4d4684e7bcf..90ac9294b5071c67ce5898bd0d89b4123a1bd4ce 100644 (file)
/*
* Simple PDF import extension using libpoppler and Cairo's SVG surface.
- *
+ *
* Authors:
* miklos erdelyi
*
#include <poppler/glib/poppler.h>
#include <poppler/glib/poppler-document.h>
#include <poppler/glib/poppler-page.h>
-
+
namespace Inkscape {
namespace Extension {
namespace Internal {
PdfInputCairo::open(Inkscape::Extension::Input * mod, const gchar * uri) {
gchar* filename_uri = g_filename_to_uri(uri, NULL, NULL);
-
+
PopplerDocument* document = poppler_document_new_from_file(filename_uri, NULL, NULL);
if (document == NULL)
return NULL;
cairo_surface_t* surface = cairo_svg_surface_create_for_stream(Inkscape::Extension::Internal::_write_ustring_cb,
output, width, height);
cairo_t* cr = cairo_create(surface);
-
+
poppler_page_render(page, cr);
cairo_show_page(cr);
-
+
cairo_destroy(cr);
cairo_surface_destroy(surface);
SPDocument * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE);
-
+
delete output;
g_object_unref(page);
g_object_unref(document);
-
+
return doc;
}