java获取Pdf文件页码步骤如下:
- 引入依赖:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.8.11</version>
</dependency>
- 获取文件页码
//pdfName:pdf文件路径
PDDocument pdDocument = PDDocument.load(pdfName);
Integer page=pdDocument.getNumberOfPages()