PDFBox 的 getXDirAdj() 方法返回哪个度量单位
Which unit of measurement is returned by the PDFBox's getXDirAdj() method
我正在使用 PDFBox 从读取的 PDF 中提取字符坐标。但是,我无法识别getXDirAdj()和getYDirAdj()方法返回值的计量单位?
@Override
protected void processTextPosition(TextPosition text) {
String tChar = text.getCharacter();
System.out.println("String[" + text.getXDirAdj() + ","
+ text.getYDirAdj() + " fs=" + text.getFontSize() + " xscale="
+ text.getXScale() + " height=" + text.getHeightDir() + " space="
+ text.getWidthOfSpace() + " width="
+ text.getWidthDirAdj() + "]" + text.getCharacter());
}
1 个单位 = 1/72 英寸
“如何获取字符读取的旋转”:来自ExtractText.java工具:
static int getAngle(TextPosition text)
{
Matrix m = text.getTextMatrix().clone();
m.concatenate(text.getFont().getFontMatrix());
return (int) Math.round(Math.toDegrees(Math.atan2(m.getShearY(), m.getScaleY())));
}
我正在使用 PDFBox 从读取的 PDF 中提取字符坐标。但是,我无法识别getXDirAdj()和getYDirAdj()方法返回值的计量单位?
@Override
protected void processTextPosition(TextPosition text) {
String tChar = text.getCharacter();
System.out.println("String[" + text.getXDirAdj() + ","
+ text.getYDirAdj() + " fs=" + text.getFontSize() + " xscale="
+ text.getXScale() + " height=" + text.getHeightDir() + " space="
+ text.getWidthOfSpace() + " width="
+ text.getWidthDirAdj() + "]" + text.getCharacter());
}
1 个单位 = 1/72 英寸
“如何获取字符读取的旋转”:来自ExtractText.java工具:
static int getAngle(TextPosition text) { Matrix m = text.getTextMatrix().clone(); m.concatenate(text.getFont().getFontMatrix()); return (int) Math.round(Math.toDegrees(Math.atan2(m.getShearY(), m.getScaleY()))); }