pdf-input.cpp revision 7b6756286b586458dc20b0b5310cb61b413d97bf
257N/A#ifdef HAVE_CONFIG_H
257N/A#include "pdf-input.h"
257N/A#ifdef HAVE_POPPLER
257N/A#ifdef HAVE_POPPLER_CAIRO
3817N/A#include "svg-builder.h"
257N/A#include "pdf-parser.h"
257N/A#include "document-private.h"
257N/A#include "document-undo.h"
257N/A#include "inkscape.h"
257N/A#include "dialogs/dialog-events.h"
257N/A#include "ui/widget/spinbutton.h"
3477N/A // more info: http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/page_bounds/
3817N/A#ifdef HAVE_POPPLER_CAIRO
#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0);
_pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1));
for ( int i = 0 ; i < num_crop_choices ; i++ ) {
#if WITH_GTKMM_2_24
_labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:")));
_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.")));
#if WITH_GTKMM_3_0
#if WITH_GTKMM_2_24
_localFontsCheck = Gtk::manage(new class Gtk::CheckButton(_("Replace PDF fonts by closest-named installed fonts")));
this->set_modal(true);
this->set_resizable(true);
#if WITH_GTKMM_3_0
_previewArea->signal_expose_event().connect(sigc::mem_fun(*this, &PdfImportDialog::_onExposePreview));
_pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPageNumberChanged));
_fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPrecisionChanged));
_render_thumb = false;
#ifdef HAVE_POPPLER_CAIRO
_render_thumb = true;
if (doc_uri) {
#ifdef HAVE_POPPLER_CAIRO
if (_cairo_surface) {
if (_poppler_doc) {
if (_thumb_data) {
if (_render_thumb) {
delete _thumb_data;
show();
hide();
return TRUE;
return FALSE;
return _current_page;
for ( ; i < num_crop_choices ; i++ ) {
#ifdef HAVE_POPPLER_CAIRO
* Borrowed from libpoppler, from the file poppler-page.cc
unsigned char *data,
unsigned int *src;
for (y = 0; y < cairo_height; y++)
for (x = 0; x < cairo_width; x++)
src++;
#if !WITH_GTKMM_3_0
if (!_thumb_data) {
if (_render_thumb) {
if (!thumb) {
if (_render_thumb) {
#ifdef HAVE_POPPLER_CAIRO
if (_render_thumb) {
if (!_render_thumb) {
if (_thumb_data) {
#ifdef HAVE_POPPLER_CAIRO
if (_thumb_data) {
delete _thumb_data;
if (_cairo_surface) {
if (!globalParams) {
// poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from glib gstdio.c
#ifndef WIN32
return NULL;
PDFDoc *pdf_doc = new PDFDoc(wfilename, wcslen(wfilename), NULL, NULL, NULL); // TODO: Could ask for password
delete pdf_doc;
return NULL;
if (inkscape_use_gui()) {
delete dlg;
delete pdf_doc;
return NULL;
int page_num;
if (dlg)
if (dot) {
*dot = 0;
if (dlg)
double crop_setting;
switch (crop_choice) {
double color_delta;
delete pdf_parser;
delete builder;
delete pdf_doc;
delete dlg;
return doc;
#include "../clear-n_.h"
"<mimetype>application/pdf</mimetype>\n"
"<mimetype>image/x-adobe-illustrator</mimetype>\n"
"<filetypetooltip>" N_("Open files saved in Adobe Illustrator 9.0 and newer versions") "</filetypetooltip>\n"