如何优雅的将pdf多页拆解成多个pdf
啊啊啊,Aspose Pdf多页拆解成多个pdf,不是正版的,哪怕是盗版的,也只是体验版而已,一个pdf不能超过4页,一旦超过4页,照样告诉你,不好意思体验版最多只能转4页;
那么要怎么去改呢,楼主痛定思痛,找了很多地方,发现.net一堆的api,java的文档少的让我心寒,最后找了很久,才把方法写出来。
public static List<File> departPdf(String pdfToocrFolder, File sourceFile, String inOrderNo, String foder) throws Exception {
List<File> resultFiles = new ArrayList<>();
FileOutputStream outStream = null;
ByteArrayOutputStream baos = null;
try {
File distDir = new File(pdfToocrFolder + File.separator + inOrderNo + File.separator + foder);
if (FileUtil.isPdf(sourceFile)) {
String sourceName = sourceFile.getName();
sourceName = sourceName.substring(0, sourceName.lastIndexOf("."));
int fileNumber = 1;
String sourcePath = sourceFile.getAbsolutePath();
InputStream inputStream = new BufferedInputStream(new FileInputStream(sourceFile));
PDDocument doc = PDDocument.load(inputStream);
int pageCount =