Code

Added code to initialize DBus (if enabled.)
[inkscape.git] / src / extension / internal / pdf-input-cairo.cpp
index 2b38481e12a6a0c28b92f8215dc1c4d4684e7bcf..937fefb1117636f7c1cba87534697813c7e4960c 100644 (file)
@@ -1,6 +1,6 @@
  /*
  * Simple PDF import extension using libpoppler and Cairo's SVG surface.
- * 
+ *
  * Authors:
  *   miklos erdelyi
  *
@@ -25,7 +25,7 @@
 #include <poppler/glib/poppler.h>
 #include <poppler/glib/poppler-document.h>
 #include <poppler/glib/poppler-page.h>
-        
+
 namespace Inkscape {
 namespace Extension {
 namespace Internal {
@@ -33,10 +33,12 @@ namespace Internal {
 static cairo_status_t _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length);
 
 SPDocument *
-PdfInputCairo::open(Inkscape::Extension::Input * mod, const gchar * uri) {
+PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
+
+    printf("Attempting to open using PdfInputCairo\n");
 
     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;
@@ -49,19 +51,19 @@ PdfInputCairo::open(Inkscape::Extension::Input * mod, const gchar * uri) {
     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;
 }
 
@@ -82,7 +84,7 @@ PdfInputCairo::init(void) {
     Inkscape::Extension::Extension * ext;
 
     ext = Inkscape::Extension::build_from_mem(
-        "<inkscape-extension>\n"
+        "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
             "<name>PDF Input</name>\n"
             "<id>org.inkscape.input.pdf</id>\n"
             "<input>\n"