Hi all,

I have attached a patch that fixes the rotation in the pdftocairo case. I found out that the bug was only present for PDF that where page size width is greater than height. (seem related to https://bugs.launchpad.net/inkscape/+bug/437550 )

This unifies behavior with pdftops. Please consider merging! All unit tests still pass.

Thanks,
Pierre-Luc

On 07/12/2016 12:27 PM, Pierre-Luc Samuel wrote:
Hi all,

I've been experimenting with using pdftocairo as a replacement to pdftops, but I am encountering a bug with document rotation.

"pdftops" respects rotations
"pdftocairo -ps" has correct 90 and 270 degrees, but 0 and 180 degrees are inverted. Files attached.

I have some time to investigate this, but do you guys think it would be a poppler bug or a libcairo bug?

Thanks,
Pierre-Luc


_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

>From 01cf9d140e4a71e8a3143d9e4165aab1d667c888 Mon Sep 17 00:00:00 2001
From: Pierre-Luc Samuel <[email protected]>
Date: Tue, 12 Jul 2016 16:19:27 -0400
Subject: [PATCH] pdftocairo: Fix rotation of landscape documents for
 postscript output

---
 utils/pdftocairo.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 2997683..9cfe395 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -648,9 +648,9 @@ static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg,
   cairo_save(cr);
   if (ps && output_w > output_h) {
     // rotate 90 deg for landscape
-    cairo_translate (cr, 0, output_w);
-    cairo_matrix_init (&m, 0, -1, 1, 0, 0, 0);
+    cairo_matrix_init_rotate (&m, M_PI_2);
     cairo_transform (cr, &m);
+    cairo_translate (cr, 0, -output_h);
   }
   cairo_translate (cr, -crop_x, -crop_y);
   if (printing) {
-- 
1.9.1

_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to