pdf-input-cairo.cpp revision f466f1e98686d23a3bbe572e4fb227e64c6436f3
5909N/A#ifdef HAVE_CONFIG_H
5909N/A#ifdef HAVE_POPPLER_GLIB
5909N/A#ifdef HAVE_POPPLER_CAIRO
5909N/A#include "pdf-input-cairo.h"
5909N/A#include "dialogs/dialog-events.h"
5909N/A#include "document.h"
5909N/A#include "inkscape.h"
5909N/A#include <cairo-svg.h>
5909N/A#include "ui/widget/spinbutton.h"
5994N/A // more info: http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/page_bounds/
5909N/A Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, num_pages, 1, 10, 0));
5994N/A _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1));
5909N/A for ( int i = 0 ; i < num_crop_choices ; i++ ) {
5909N/A _pageSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Page settings")));
5909N/A _labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:")));
5909N/A _labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance.")));
5909N/A _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10));
5909N/A _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj));
5909N/A _localFontsCheck = Gtk::manage(new class Gtk::CheckButton(_("Replace PDF fonts by closest-named installed fonts")));
5994N/A _importSettingsFrame = Gtk::manage(new class Inkscape::UI::Widget::Frame(_("Import settings")));
5909N/A this->set_resizable(true);
5909N/A this->set_has_separator(true);
5909N/A _previewArea->signal_expose_event().connect(sigc::mem_fun(*this, &PdfImportCairoDialog::_onExposePreview));
5909N/A _pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportCairoDialog::_onPageNumberChanged));
5909N/A _cropCheck->signal_toggled().connect(sigc::mem_fun(*this, &PdfImportCairoDialog::_onToggleCropping));
5909N/A _fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportCairoDialog::_onPrecisionChanged));
5909N/A _render_thumb = false;
5909N/A _render_thumb = true;
5909N/A if (_cairo_surface) {
5909N/A if (_thumb_data) {
5909N/A if (_render_thumb) {
5909N/A delete _thumb_data;
5909N/A delete _thumb_data;
5909N/A return _current_page;
5909N/A for ( ; i < num_crop_choices ; i++ ) {
5909N/A * Borrowed from libpoppler, from the file poppler-page.cc
5909N/A for (y = 0; y < cairo_height; y++)
5909N/A for (x = 0; x < cairo_width; x++)
if (!_thumb_data) {
if (_render_thumb) {
if (!thumb) {
if (_render_thumb) {
if (!back_pixmap) {
if (_render_thumb) {
if (!_render_thumb) {
if (_thumb_data) {
int rotate = 0;
if (_thumb_data) {
delete _thumb_data;
if (_cairo_surface) {
static cairo_status_t _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length);
return NULL;
if (inkscape_use_gui()) {
delete dlg;
return NULL;
int page_num;
if (dlg) {
delete dlg;
cairo_surface_t* surface = cairo_svg_surface_create_for_stream(Inkscape::Extension::Internal::_write_ustring_cb,
delete output;
return doc;
static cairo_status_t
return CAIRO_STATUS_SUCCESS;
#include "clear-n_.h"
"<id>org.inkscape.input.cairo-pdf</id>\n"
"<mimetype>application/pdf</mimetype>\n"