Bug 689418 - AutoRotatePages differences GS vs Distiller
Summary: AutoRotatePages differences GS vs Distiller
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC All
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-26 04:17 UTC by SaGS
Modified: 2010-08-13 08:53 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Sample/ test pack (ZIP file). (259.67 KB, application/x-zip-compressed)
2007-08-26 04:20 UTC, SaGS
Details
Suggested patch. (1.58 KB, patch)
2007-08-26 04:21 UTC, SaGS
Details | Diff
689418.ps.gz (3.73 KB, application/gzip)
2009-09-14 15:28 UTC, Alex Cherepanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SaGS 2007-08-26 04:17:31 UTC
Some details in the behaviour of /AutoRotatePages are different in 
Ghostscript than in Distiller. (My tests were with Distiller 4.05.) 
There is mention of one in bug #689267 "File converted to PDF displays 
badly in Acrobat", from which this report is a spin off.

Note:
   /AutoRotatePages does not have an exact definition. As a result, 
   one can find endless factors that potentially influence the final 
   page rotation. The sample and patch below concern only things I 
   considered most important: Type 1 and Type 3 fonts, text rotation 
   in multiples of 90deg, and mirroring.
Comment 1 SaGS 2007-08-26 04:20:28 UTC
Created attachment 3308 [details]
Sample/ test pack (ZIP file).

Attached ZIP includes the following files:

Bug999093-[autorot]-test.ps

    File that shows the differences in AutoRotatePages behaviour, 
    also used for testing. Contains 1024 cases, all combinations of:

  - Type 1 or Type 3 font;
  - mirroring and/or 0/90/180/270deg rotation in the original 
    FontMatrix (at definefont time);
  - same, in the matrix passed to makefont when creating the font 
    used to draw the text;
  - same, in the PS current->default user space transform.

    Convert to PDF using "/AutoRotatePages = /PageByPage" and compare 
    results from different converters. The file uses pdfmarks to 
    store all above information in the output PDF.

Bug999093-[autorot]-testinfo.ps

    Extracts the info about mirroring/rotation stored in the PDF 
    plus the resulting page /Rotate and dumps them to a tab-delimited 
    text file for easy comparison. For usage, see comments in file.

Bug999093-[autorot]-test-Distiller4,05.pdf
Bug999093-[autorot]-test-gs8204EX.pdf

    PDF files created by Distiller 4.05 and unpatched Ghostscript rev 
    8204 from the test file. The big red arrows indicate the PS user 
    space orientation at distill-time.
    
    Note:
	The "EX" means "with an unrelated [for bug #689267] patch 
	applied". That patch does not influence rotation, but fixes 
	glyphs placement to make visual/ raster comparison possible.
Comment 2 SaGS 2007-08-26 04:21:33 UTC
Created attachment 3309 [details]
Suggested patch.

Distiller's rules for AutoRotatePages are weird, but this patch makes 
Ghostscript produce the same output as Distiller. The cases taken in 
consideration are those mentioned in comment #1.
Comment 3 Alex Cherepanov 2009-09-14 15:28:13 UTC
Created attachment 5374 [details]
689418.ps.gz

PS file from the ZIP archive with a fix for misplaced bind operator.
Comment 4 Ken Sharp 2010-08-13 08:53:12 UTC
(In reply to comment #0)
> Some details in the behaviour of /AutoRotatePages are different in 
> Ghostscript than in Distiller. (My tests were with Distiller 4.05.) 
> There is mention of one in bug #689267 "File converted to PDF displays 
> badly in Acrobat", from which this report is a spin off.
> 
> Note:
>    /AutoRotatePages does not have an exact definition. As a result, 
>    one can find endless factors that potentially influence the final 
>    page rotation. The sample and patch below concern only things I 
>    considered most important: Type 1 and Type 3 fonts, text rotation 
>    in multiples of 90deg, and mirroring.

I haven't looked at all 1024 (!) pages of output produced by the PostScript file, but....

On the whole I personally prefer the behaviour of pdfwrite, I think its more consistent since the text is more frequently presented running left to right. At times Distiller produces text which runs in every possible direction, and on some occasions the text doesn't run left to right, and the CTM is not 'upright' either.

I don't think there's any need for us to conform exactly to the way Adobe works, and our users will expect the behaviour to remain as it does now so I'm going to turn this one down for the present at least. Should there be actual customer complaints about the AutoRotatePages feature and the way it works then I'll reconsider this.

Many thanks for your efforts anyway, it is appreciated, and we may one day use the code if someone produces a file which is sufficiently wrong to be a problem.