ralfstuckert / pdfbox-layout

MIT License
156 stars 74 forks source link

New page rotation issue #45

Open andrewvsk opened 7 years ago

andrewvsk commented 7 years ago

Look like a bug in condition: isPageTilted() - it always returns false.

RenderContext.java

public void newPage() throws IOException {
        ...
        this.page = new PDPage(getPageFormat().getMediaBox());
        ....
    // fix orientation
    if (getPageOrientation() != getPageFormat().getOrientation()) {
        if (isPageTilted()) {                   // <---- HERE IS BUG!
        page.setRotation(0);
        } else {
        page.setRotation(90);
        }
    }

Possible fix:

if (getPageFormat().getOrientation() == Orientation.Landscape) {
    page.setRotation(90);
}