[gs-cvs] rev 9302 - trunk/gs/base

ken at ghostscript.com ken at ghostscript.com
Tue Dec 23 01:05:30 PST 2008


Author: ken
Date: 2008-12-23 01:05:30 -0800 (Tue, 23 Dec 2008)
New Revision: 9302

Modified:
   trunk/gs/base/gdevpdf.c
Log:
Fix (pdfwrite): DSC comments interfering with Page Tree Orientation.

Details:
Bug #689922 "Rotation issues with pdfwrite and multiple operations".

When writing out a PDF file, pdfwrite adds /Rotate keys to individual pages, and if the document is gnerally rotated (eg landscape) will set a /Rotate key in the pages treee. This causes all pages which do not have their own value to inherit this as a default.

Unfortunately, the page tree code uses the same logic as the individual page, whch honours DSC '%%Orientation' and '%%ViewingOrientation' comments. If the last file processed contained one of these, this would become the default for all pages, regardless of their actual orientation. This would cause pages to be inappropriately rotated.

Fixed by clearing the DSC information before writing the orientation for the page tree, by this time all the pages that require it have already been written with their own value.

EXPECTED DIFFERENCES:
None.


Modified: trunk/gs/base/gdevpdf.c
===================================================================
--- trunk/gs/base/gdevpdf.c	2008-12-21 14:34:29 UTC (rev 9301)
+++ trunk/gs/base/gdevpdf.c	2008-12-23 09:05:30 UTC (rev 9302)
@@ -1138,8 +1138,15 @@
 	    pprintld1(s, "%ld 0 R\n", pdev->pages[i].Page->id);
     }
     pprintd1(s, "] /Count %d\n", pdev->next_page);
+
+    /* If the last file was PostScript, its possible that DSC comments might be lying around
+     * and pdf_print_orientation will use that if its present. So make sure we get rid of those
+     * before considering the dominant page direction for the Pages tree.
+     */
+    pdev->doc_dsc_info.viewing_orientation = pdev->doc_dsc_info.orientation = -1;
     pdev->text_rotation.Rotate = pdf_dominant_rotation(&pdev->text_rotation);
     pdf_print_orientation(pdev, NULL);
+
     cos_dict_elements_write(pdev->Pages, pdev);
     stream_puts(s, ">>\n");
     pdf_end_obj(pdev);



More information about the gs-cvs mailing list