|
|
1b60d7 |
--- a/backend/pdf/ev-poppler.cc
|
|
|
1b60d7 |
+++ b/backend/pdf/ev-poppler.cc
|
|
|
1b60d7 |
@@ -1037,6 +1037,7 @@ pdf_document_get_info (EvDocument *document)
|
|
|
1b60d7 |
PopplerPermissions permissions;
|
|
|
1b60d7 |
char *metadata;
|
|
|
1b60d7 |
gboolean linearized;
|
|
|
1b60d7 |
+ PopplerPrintScaling print_scaling;
|
|
|
1b60d7 |
|
|
|
1b60d7 |
info = g_new0 (EvDocumentInfo, 1);
|
|
|
1b60d7 |
|
|
|
1b60d7 |
@@ -1068,6 +1069,7 @@ pdf_document_get_info (EvDocument *document)
|
|
|
1b60d7 |
"page-mode", &mode,
|
|
|
1b60d7 |
"page-layout", &layout,
|
|
|
1b60d7 |
"viewer-preferences", &view_prefs,
|
|
|
1b60d7 |
+ "print-scaling", &print_scaling,
|
|
|
1b60d7 |
"permissions", &permissions,
|
|
|
1b60d7 |
"creator", &(info->creator),
|
|
|
1b60d7 |
"producer", &(info->producer),
|
|
|
1b60d7 |
@@ -1160,6 +1162,20 @@ pdf_document_get_info (EvDocument *document)
|
|
|
1b60d7 |
info->ui_hints |= EV_DOCUMENT_UI_HINT_DIRECTION_RTL;
|
|
|
1b60d7 |
}
|
|
|
1b60d7 |
|
|
|
1b60d7 |
+ /*
|
|
|
1b60d7 |
+ * Save the PrintScaling preference in the bit field
|
|
|
1b60d7 |
+ * so we don't need to modify EvDocumentInfo type downstream
|
|
|
1b60d7 |
+ */
|
|
|
1b60d7 |
+ switch (print_scaling) {
|
|
|
1b60d7 |
+ default:
|
|
|
1b60d7 |
+ case POPPLER_PRINT_SCALING_APP_DEFAULT:
|
|
|
1b60d7 |
+ info->ui_hints &= ~(1 << 30);
|
|
|
1b60d7 |
+ break;
|
|
|
1b60d7 |
+ case POPPLER_PRINT_SCALING_NONE:
|
|
|
1b60d7 |
+ info->ui_hints |= 1 << 30;
|
|
|
1b60d7 |
+ break;
|
|
|
1b60d7 |
+ }
|
|
|
1b60d7 |
+
|
|
|
1b60d7 |
info->permissions = 0;
|
|
|
1b60d7 |
if (permissions & POPPLER_PERMISSIONS_OK_TO_PRINT) {
|
|
|
1b60d7 |
info->permissions |= EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT;
|
|
|
1b60d7 |
--- a/libview/ev-print-operation.c
|
|
|
1b60d7 |
+++ b/libview/ev-print-operation.c
|
|
|
1b60d7 |
@@ -1953,9 +1953,14 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
|
|
|
1b60d7 |
EvPrintScale page_scale;
|
|
|
1b60d7 |
gboolean autorotate;
|
|
|
1b60d7 |
gboolean use_source_size;
|
|
|
1b60d7 |
+ EvDocumentInfo *info;
|
|
|
1b60d7 |
|
|
|
1b60d7 |
settings = gtk_print_operation_get_print_settings (print->op);
|
|
|
1b60d7 |
- page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 1);
|
|
|
1b60d7 |
+ info = ev_document_get_info (EV_PRINT_OPERATION (print)->document);
|
|
|
1b60d7 |
+ if (info->ui_hints & (1 << 30))
|
|
|
1b60d7 |
+ page_scale = EV_SCALE_NONE;
|
|
|
1b60d7 |
+ else
|
|
|
1b60d7 |
+ page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 1);
|
|
|
1b60d7 |
autorotate = gtk_print_settings_has_key (settings, EV_PRINT_SETTING_AUTOROTATE) ?
|
|
|
1b60d7 |
gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_AUTOROTATE) :
|
|
|
1b60d7 |
TRUE;
|
|
|
1b60d7 |
--- a/shell/ev-window.c
|
|
|
1b60d7 |
+++ b/shell/ev-window.c
|
|
|
1b60d7 |
@@ -3040,10 +3040,23 @@ ev_window_save_print_settings (EvWindow
|
|
|
1b60d7 |
GtkPrintSettings *print_settings)
|
|
|
1b60d7 |
{
|
|
|
1b60d7 |
GKeyFile *key_file;
|
|
|
1b60d7 |
- gint i;
|
|
|
1b60d7 |
+ gint i, page_scale;
|
|
|
1b60d7 |
+ EvDocumentInfo *info;
|
|
|
1b60d7 |
|
|
|
1b60d7 |
key_file = get_print_settings_file ();
|
|
|
1b60d7 |
+
|
|
|
1b60d7 |
+ /* Do not store page scaling enforced by opened document */
|
|
|
1b60d7 |
+ info = ev_document_get_info (window->priv->document);
|
|
|
1b60d7 |
+ page_scale = gtk_print_settings_get_int (print_settings, "evince-print-setting-page-scale");
|
|
|
1b60d7 |
+ if (info->ui_hints & (1 << 30) && page_scale == 0) {
|
|
|
1b60d7 |
+ page_scale = g_key_file_get_integer (key_file,
|
|
|
1b60d7 |
+ EV_PRINT_SETTINGS_GROUP,
|
|
|
1b60d7 |
+ "evince-print-setting-page-scale",
|
|
|
1b60d7 |
+ NULL);
|
|
|
1b60d7 |
+ }
|
|
|
1b60d7 |
+
|
|
|
1b60d7 |
gtk_print_settings_to_key_file (print_settings, key_file, EV_PRINT_SETTINGS_GROUP);
|
|
|
1b60d7 |
+ g_key_file_set_integer (key_file, EV_PRINT_SETTINGS_GROUP, "evince-print-setting-page-scale", page_scale);
|
|
|
1b60d7 |
|
|
|
1b60d7 |
/* Always Remove n_copies from global settings */
|
|
|
1b60d7 |
g_key_file_remove_key (key_file, EV_PRINT_SETTINGS_GROUP, GTK_PRINT_SETTINGS_N_COPIES, NULL);
|