该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
在main方法中手动执行拆分没问题,项目调用时出错:
java.io.EOFException
at com.itextpdf.text.pdf.RandomAccessFileOrArray.readFully(RandomAccessFileOrArray.java:261)
at com.itextpdf.text.pdf.RandomAccessFileOrArray.readFully(RandomAccessFileOrArray.java:253)
at com.itextpdf.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:2254)
at com.itextpdf.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:2291)
at com.itextpdf.text.pdf.PRStream.toPdf(PRStream.java:215)
at com.itextpdf.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:157)
at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:396)
at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:376)
at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:368)
at com.itextpdf.text.pdf.PdfWriter.addToBody(PdfWriter.java:806)
at com.itextpdf.text.pdf.PdfCopy.copyIndirect(PdfCopy.java:214)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:282)
at com.itextpdf.text.pdf.PdfCopy.copyDictionary(PdfCopy.java:236)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:280)
at com.itextpdf.text.pdf.PdfCopy.copyIndirect(PdfCopy.java:213)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:282)
at com.itextpdf.text.pdf.PdfCopy.copyDictionary(PdfCopy.java:236)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:280)
at com.itextpdf.text.pdf.PdfCopy.copyIndirect(PdfCopy.java:213)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:282)
at com.itextpdf.text.pdf.PdfCopy.copyDictionary(PdfCopy.java:236)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:280)
at com.itextpdf.text.pdf.PdfCopy.copyDictionary(PdfCopy.java:236)
at com.itextpdf.text.pdf.PdfCopy.copyObject(PdfCopy.java:280)
at com.itextpdf.text.pdf.PdfCopy.copyDictionary(PdfCopy.java:233)
at com.itextpdf.text.pdf.PdfCopy.addPage(PdfCopy.java:362)
例子附后