public static int getTIFFPageNum(String srcPath) {
File srcFile = new File(srcPath);
InputStream fis = null;
try {
fis = new FileInputStream(srcFile);
TIFFDecodeParam decodeParam = new TIFFDecodeParam();
ImageDecoder decoder = ImageCodec.createImageDecoder("TIFF", fis,
decodeParam);
return decoder.getNumPages();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != fis) {
fis.close();
}
} catch (Exception e) {
}
}
return 0;
}
阅读(712) | 评论(0) | 转发(0) |