PDFBox - find page dimensions

前端 未结 3 1454
孤城傲影
孤城傲影 2020-12-29 03:18

How can I find(in mm) the width and the height of a pdf page using PDFBox? Currently, I\'m using this:

System.out.println(page.getMediaBox().getHeight());
Sy         


        
3条回答
  •  心在旅途
    2020-12-29 03:57

    Coordinates in DTP points are defined as: 1 pt = 1/72 inch = 25.4/72 mm

    You could write a method like this:

    public float pt2mm(float pt) {
       return pt * 25.4f / 72;
    }
    

提交回复
热议问题