Java 如何使用PDFBOX确定图像旋转小于90度

Java 如何使用PDFBOX确定图像旋转小于90度,java,validation,pdf,pdfbox,Java,Validation,Pdf,Pdfbox,嗨,我想在PDFBOx中检查以下场景: 图像旋转的角度不是90度的倍数。 在这个话题上谁能帮忙。 示例PDF位置: 正如斯劳德所说,我已经把它写得很长了 //set the angle of the image double angle; if(angle % 90 == 0){ //Perform operation when the angle is multiple of 90 }else{ //Perform operation when the angle is NOT multipl

嗨,我想在PDFBOx中检查以下场景: 图像旋转的角度不是90度的倍数。 在这个话题上谁能帮忙。 示例PDF位置:

正如斯劳德所说,我已经把它写得很长了

//set the angle of the image
double angle;
if(angle % 90 == 0){
//Perform operation when the angle is multiple of 90
}else{
//Perform operation when the angle is NOT multiple of 90
}

这就是您如何处理此场景的方法

布尔multipleof90=角度%90==0;检查页面内容流。你会发现q 325.79257-42.55899 30.90112 236.55064 164.64209 365.19037 cm/X1 Do q。将变换矩阵分解为平移、缩放、旋转和倾斜部分。看旋转矩阵。嗨,你能告诉我如何推导PDXObjectImage对象的旋转角度吗?@ShreyosAdikari取一个向量,应用变换矩阵,计算原始向量和变换向量之间的角度。如果涉及倾斜,您对开始向量的选择会影响结果,应该进行规范化以最适合您的需要。尊敬的MKL,获取当前变换矩阵(包含变换的平移、旋转、缩放和倾斜组件)的PDFBox API是PDGraphicsState.getCurrentTransformationMatrix。这将返回org.apache.pdfbox.util.Matrix。它包含提取缩放和平移矩阵的方法,但奇怪的是,它不包含任何获取旋转矩阵的方法。我们需要一种方法来获得图像的旋转矩阵,并从中提取相对于默认坐标系的旋转角度。对此有任何帮助或建议吗?如何确定PDXObjectImages的角度?问题的关键是确定PDF中图像的旋转角度。