[libgxps] xpstopdf: make the generated pdf to be 96 dpi
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] xpstopdf: make the generated pdf to be 96 dpi
- Date: Mon, 12 Mar 2018 16:52:34 +0000 (UTC)
commit acd80e1178ba386597961f4669d3e82e8dd1c00c
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Fri Mar 9 16:25:11 2018 +0100
xpstopdf: make the generated pdf to be 96 dpi
The page size we get from the xps metadata is in points. When we
pass this size to cairo we should convert it to 96 dpi since it
is the dpi we have by default on Windows, without this conversion
the generated pdf will be using a bigger page size.
Moreover evince does this conversion as well by itself.
https://bugzilla.gnome.org/show_bug.cgi?id=794248
tools/gxps-print-converter.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/tools/gxps-print-converter.c b/tools/gxps-print-converter.c
index 140efde..a4f2e13 100644
--- a/tools/gxps-print-converter.c
+++ b/tools/gxps-print-converter.c
@@ -266,13 +266,17 @@ _gxps_converter_print_get_output_size (GXPSPrintConverter *converter,
gxps_page_get_size (page, &page_width, &page_height);
+ /* The page width is in points, Windows expects a dpi of 96 while
+ * cairo will handle the dpi in 72. We need to make the conversion
+ * ourselves so we have the right output size
+ */
if (output_width) {
*output_width = converter->paper_width == 0 ?
- page_width : converter->paper_width;
+ page_width * 72.0 / 96.0 : converter->paper_width;
}
if (output_height) {
*output_height = converter->paper_height == 0 ?
- page_height : converter->paper_height;
+ page_height * 72.0 / 96.0 : converter->paper_height;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]