yob / pdf-reader

The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.
MIT License
1.81k stars 271 forks source link

Apply page rotation to text after rendering, rather than before #350

Closed yob closed 3 years ago

yob commented 3 years ago

I originally added page rotation support in #317 and #318. They got specs passing, but as I've collected more sample PDFs I'm not sure the implementation was correct.

I has specs for 180 and 270 degree rotation, and this adds a new one for 90 degree rotation that's based on a real-world PDF is was provided privately.

The existing implementation didn't work with that file, but after some trial and error I found that applying the rotation after rendering the page state works for all the sample PDFs I have.