我正在尝试确定pdf页面上的文本是垂直(从下到上)而不是水平(从左到右)流动 . 所以我在How to find pdf is portrait or landscape using PDFBOX Library in Java尝试了答案 . 我'm using pdfbox 2.0.3 and here' s我的代码是什么样的:

public PDFTextStripperChildClass() throws IOException {
    super();
    setSortByPosition(false);
    setShouldSeparateByBeads(true);
    setPageStart("");
    setPageEnd("");
    setParagraphEnd("");
    setParagraphStart("");
    setArticleStart("");
    setArticleEnd("");
    setLineSeparator("\n");

    isParsingOngoing = false;
}


@Override
protected void writeString(String txt, List<TextPosition> tp) {

    ...

    PDPage pdp = this.getCurrentPage();
    PDRectangle pdr = pdp.getMediaBox();
    boolean isLandscape = pdr.getWidth() > pdr.getHeight();
    int rotation = pdp.getRotation();

    if (isLandscape || rotation == 90 || rotation == 270) {
        System.out.println("landscape or rotated");
    }

    ...
}

虽然当我通过带有旋转横向页面的文档运行它时,没有任何内容被打印出来 . 我没有正确引导PDFTextStripper吗?