pdf-input-cairo.cpp revision 368f41429bd8478e4d22f20c54523c6a28ee5bce
df8bdeb362277e8d95a74d6c097341fe97409948johnz * Simple PDF import extension using libpoppler and Cairo's SVG surface.
df8bdeb362277e8d95a74d6c097341fe97409948johnz * miklos erdelyi
df8bdeb362277e8d95a74d6c097341fe97409948johnz * Copyright (C) 2007 Authors
df8bdeb362277e8d95a74d6c097341fe97409948johnz * Released under GNU GPL, read the file 'COPYING' for more information
df8bdeb362277e8d95a74d6c097341fe97409948johnzstatic cairo_status_t _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length);
df8bdeb362277e8d95a74d6c097341fe97409948johnzPdfInputCairo::open(Inkscape::Extension::Input * mod, const gchar * uri) {
df8bdeb362277e8d95a74d6c097341fe97409948johnz gchar* filename_uri = g_filename_to_uri(uri, NULL, NULL);
df8bdeb362277e8d95a74d6c097341fe97409948johnz PopplerDocument* document = poppler_document_new_from_file(filename_uri, NULL, NULL);
df8bdeb362277e8d95a74d6c097341fe97409948johnz PopplerPage* page = poppler_document_get_page(document, 0);
df8bdeb362277e8d95a74d6c097341fe97409948johnz cairo_surface_t* surface = cairo_svg_surface_create_for_stream(Inkscape::Extension::Internal::_write_ustring_cb,
df8bdeb362277e8d95a74d6c097341fe97409948johnz SPDocument * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE);
df8bdeb362277e8d95a74d6c097341fe97409948johnz _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length)
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<inkscape-extension>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<name>PDF Input</name>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<id>org.inkscape.input.pdf</id>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<input>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<extension>.pdf</extension>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz "<mimetype>application/pdf</mimetype>\n"
8bab47abcb471dffa36ddbf409a8ef5303398ddfJohn.Zolnowsky@Sun.COM "<filetypename>Adobe PDF (*.pdf)</filetypename>\n"
8bab47abcb471dffa36ddbf409a8ef5303398ddfJohn.Zolnowsky@Sun.COM "<filetypetooltip>PDF Document</filetypetooltip>\n"
df8bdeb362277e8d95a74d6c097341fe97409948johnz} } } /* namespace Inkscape, Extension, Implementation */
df8bdeb362277e8d95a74d6c097341fe97409948johnz#endif /* HAVE_POPPLER_GLIB */
df8bdeb362277e8d95a74d6c097341fe97409948johnz Local Variables:
735564919188238196dbd0d320770dda59b38369Anthony Scarpino c-file-style:"stroustrup"
df8bdeb362277e8d95a74d6c097341fe97409948johnz c-file-offsets:((innamespace . 0)(inline-open . 0))
df8bdeb362277e8d95a74d6c097341fe97409948johnz indent-tabs-mode:nil
df8bdeb362277e8d95a74d6c097341fe97409948johnz fill-column:99
735564919188238196dbd0d320770dda59b38369Anthony Scarpino// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :