sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.36k stars 1.7k forks source link

DJVU with rotated pages #3125

Open sergsako opened 1 year ago

sergsako commented 1 year ago

[AnGenn, a user of SumatraPDF, discovered this issue, investigated it, and told me about it. I only checked his observations and prepared this report.] test.zip This ZIP contains a DJVU document test.djvu containing three rotated pages (pp. 2, 3, 4), together with the corresponding PDF test.pdf which shows how this DJVU must be seen in a djvu-viewer and is seen exactly this way in WinDjView. Page 2 of the test.djvu was rotated (using a djvu-editor) 90 degrees left, page 3 was rotated 90 degrees right, page 4 was turned over by 180 degrees, other pages were not rotated. SumatraPDF (version 3.1.2, 3.4.6 and current pre-release, at least) shows this DJVU document test.djvu in a strange and incorrect way. Pages 2 and 3 do have the landscape orientation but the text on them reads from left to right and is stretched, and page 4 is not overturned at all.

GitHubRulesOK commented 1 year ago

hmm rotation was a problem supposed resolved in https://github.com/sumatrapdfreader/sumatrapdf/issues/1593 but does look like needs fresh review

kjk commented 1 year ago

We ignore the rotation already present on a given page and assume it's 0.

In EngineDjVu::RenderPage we need to ddjvu_page_rotation_t rot = ddjvu_page_get_rotation(page); and rotate (ddjvu_page_set_rotation()) by the difference of wanted rotation and rotation in the file.