summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e334a92)
raw | patch | inline | side by side (parent: e334a92)
author | theadib <theadib@users.sourceforge.net> | |
Sun, 16 Dec 2007 20:07:44 +0000 (20:07 +0000) | ||
committer | theadib <theadib@users.sourceforge.net> | |
Sun, 16 Dec 2007 20:07:44 +0000 (20:07 +0000) |
src/extension/internal/pdfinput/pdf-input.cpp | patch | blob | history |
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 2d6a8ea4be24909407fb3dd704bd3fc2f5fef384..9b671a7c386c362a737be838f9e2cf605e37938a 100644 (file)
namespace Inkscape {
namespace Extension {
namespace Internal {
-
+\r
/**
* \brief The PDF import dialog
* FIXME: Probably this should be placed into src/ui/dialog
PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar *uri)
{
-
+ _poppler_doc = NULL;
_pdf_doc = doc;
cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
_render_thumb = true;
// Create PopplerDocument
gchar *doc_uri = g_filename_to_uri(uri, NULL, NULL);
- if (doc_uri) {
+ if (doc_uri) {\r
_poppler_doc = poppler_document_new_from_file(doc_uri, NULL, NULL);
g_free(doc_uri);
}
src++;
}
}
-}
+}\r
+\r
#endif
/**
// Initialize the globalParams variable for poppler
if (!globalParams) {
globalParams = new GlobalParams();
- }
- GooString *filename_goo = new GooString(uri);
- PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password
+ }\r
+ // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from glib gstdio.c\r
+#ifndef WIN32
+ GooString *filename_goo = new GooString(uri);\r
+ PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password\r
+ delete filename_goo;
+#else\r
+ wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL);\r
+\r
+ if (wfilename == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ PDFDoc *pdf_doc = new PDFDoc(wfilename, wcslen(wfilename), NULL, NULL, NULL); // TODO: Could ask for password\r
+ g_free (wfilename);\r
+#endif\r
+\r
if (!pdf_doc->isOk()) {
int error = pdf_doc->getErrorCode();
delete pdf_doc;
if (error == errEncrypted) {
g_message("Document is encrypted.");
- } else {
+ } else if (error == errOpenFile) {\r
+ g_message("couldn't open the PDF file.");\r
+ } else if (error == errBadCatalog) {\r
+ g_message("couldn't read the page catalog.");\r
+ } else if (error == errDamaged) {\r
+ g_message("PDF file was damaged and couldn't be repaired.");\r
+ } else if (error == errHighlightFile) {\r
+ g_message("nonexistent or invalid highlight file.");\r
+ } else if (error == errBadPrinter) {\r
+ g_message("invalid printer.");\r
+ } else if (error == errPrinting) {\r
+ g_message("Error during printing.");\r
+ } else if (error == errPermission) {\r
+ g_message("PDF file does not allow that operation.");\r
+ } else if (error == errBadPageNum) {\r
+ g_message("invalid page number.");\r
+ } else if (error == errFileIO) {\r
+ g_message("file IO error.");\r
+ } else {\r
g_message("Failed to load document from data (error %d)", error);
}