#include "printing.h"
#include "prefs_common.h"
#include "gtk/gtkutils.h"
+#include "gtk/inputdialog.h"
#include "mimeview.h"
#ifndef POPPLER_WITH_GDK
#include "stdbool.h"
PopplerDest *dest = poppler_document_find_dest(
viewer->pdf_doc, action->goto_dest.dest->named_dest);
if (dest->type != POPPLER_DEST_XYZ) {
- g_warning("couldn't figure out link\n");
+ g_warning("couldn't figure out link");
poppler_dest_free(dest);
continue;
}
#endif
else {
#ifdef HAVE_POPPLER_DEST_NAMED
- g_warning("unhandled link type %d\nplease contact developers\n", action->goto_dest.dest->type);
+ g_warning("unhandled link type %d. please contact developers", action->goto_dest.dest->type);
#else
- g_warning("unhandled link type %d\nplease upgrade libpoppler-glib to 0.5.4\n", action->goto_dest.dest->type);
+ g_warning("unhandled link type %d. please upgrade libpoppler-glib to 0.5.4", action->goto_dest.dest->type);
#endif
continue;
}
dest = poppler_document_find_dest(
viewer->pdf_doc, viewer->link_action->goto_dest.dest->named_dest);
if (dest->type != POPPLER_DEST_XYZ) {
- g_warning("couldn't figure out link\n");
+ g_warning("couldn't figure out link");
poppler_dest_free(dest);
break;
}
dest = poppler_document_find_dest(
viewer->pdf_doc, viewer->link_action->goto_remote.dest->named_dest);
if (dest->type != POPPLER_DEST_XYZ) {
- g_warning ("couldn't figure out link\n");
+ g_warning ("couldn't figure out link");
poppler_dest_free(dest);
break;
}
{
PdfViewer *viewer = (PdfViewer *) _viewer;
- GError *error;
+ GError *error = NULL;
gchar *tmpfile = NULL;
gchar *tmp;
+ gchar *password = NULL;
debug_print("pdf_viewer_update\n");
- error = NULL;
if (reload_file) {
if (viewer->pdf_doc) {
g_object_unref(G_OBJECT(viewer->pdf_doc));
g_free(tmp);
}
else {
- g_warning("gs conversion failed: %s returned %d\n", cmdline, result);
+ g_warning("gs conversion failed: %s returned %d", cmdline, result);
tmp = g_strdup_printf("gs: err %d", result);
alertpanel_warning("%s", tmp);
g_free(tmp);
g_free(tmpfile);
}
else {
- g_warning("gs conversion disabled: gs binary was not found\n");
+ g_warning("gs conversion disabled: gs binary was not found");
alertpanel_warning("PostScript view disabled: required gs program not found");
result = 1;
else {
viewer->pdf_doc = poppler_document_new_from_file( viewer->fsname, NULL, &error);
}
+ if (error && g_error_matches(error, POPPLER_ERROR, POPPLER_ERROR_ENCRYPTED)) {
+ g_clear_error(&error);
+ password = input_dialog_with_invisible(_("Enter password"),
+ _("This document is locked and requires a password before it can be opened."),
+ "");
+ viewer->pdf_doc = poppler_document_new_from_file(viewer->fsname, password, &error);
+ g_free(password);
+ }
viewer->num_pages = poppler_document_get_n_pages(viewer->pdf_doc);
viewer->pdf_page = poppler_document_get_page(viewer->pdf_doc, page_num - 1);
if (viewer->pdf_page == NULL) {
- g_warning("Page not found\n");
+ g_warning("Page not found");
return;
}