各位程序员,您好!
我可以正确提取pdf文本坐标及其格式.但是我不能用图像做到这一点.
我可以得到适当的宽度和高度,但是它给了我错误的x和y.
我正在使用photoshop检查即时消息是否获得正确的x,y,宽度,高度坐标
但只有宽度和高度正确
这是我的代码
@Override
public void processOperator(Operator operator, List arguments) throws IOException {
if ("cm".equals(operator.getName())) {
float width = ((COSNumber)arguments.get(0)).floatValue();
float height = ((COSNumber)arguments.get(3)).floatValue();
float x = ((COSNumber)arguments.get(4)).floatValue();
float y = ((COSNumber)arguments.get(5)).floatValue();
System.out.println("w: " + width + " h: " + height + " x: " + x + " y: " + y);
// process image coordinates
}
super.processOperator(operator, arguments);
}
这是我使用的示例pdf
和即时通讯使用第2页
这是程序的输出<