pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David KELLER (JIRA)" <j...@apache.org>
Subject [jira] Created: (PDFBOX-397) merge dont work
Date Fri, 02 Jan 2009 12:17:44 GMT
merge dont work 
----------------

                 Key: PDFBOX-397
                 URL: https://issues.apache.org/jira/browse/PDFBOX-397
             Project: PDFBox
          Issue Type: Bug
          Components: Writing
    Affects Versions: 0.8.0-incubator
         Environment: Vista / Asus x51 / 3GB RAM / DUAL CORE
            Reporter: David KELLER


I want to merge 2 docs, and It work only on 1 way
merge Doc2 + Doc1 : OK
merge Doc1 + Doc2 : Fail


/* work ! */
String sFilename1 = "D:\\main_doc_pdf.pdf";
String sFilename2 = "D:\\compte-rendu.pdf";
mergeFiles(sFilename1, sFilename2);


/* failed ! */
String sFilename1 = "D:\\compte-rendu.pdf";
String sFilename2 = "D:\\main_doc_pdf.pdf";
mergeFiles(sFilename1, sFilename2);


with this method :
public static void mergeFiles(
String sFilename1,
String sFilename2)
throws COSVisitorException, IOException
{
PDFMergerUtility merger = new PDFMergerUtility();
merger.addSource(sFilename1);
merger.addSource(sFilename2);

merger.setDestinationFileName(sFilename1 + "_cr.pdf");
merger.mergeDocuments();

}



here the Exception :

Exception in thread "main"
org.apache.pdfbox.exceptions.COSVisitorException: Descripteur non valide
at
org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:939)
at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:201)
at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:206)
at
org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:430)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:361)
at
org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:768)

at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:383)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1070)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:722)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:703)
at
org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.jav
a:144)
at
mt.paraph.folder.report.ParaphFolderReport.mergeFiles(ParaphFolderReport.ja
va:72)
at
mt.paraph.folder.report.ParaphFolderReport.main(ParaphFolderReport.java:55)

java.io.IOException: Descripteur non valide
at java.io.RandomAccessFile.seek(Native Method)
at org.apache.pdfbox.io.RandomAccessFile.seek(RandomAccessFile.java:59)
at
org.apache.pdfbox.io.RandomAccessFileInputStream.read(RandomAccessFileInput
Stream.java:96)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at
org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:926)
at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:201)
at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:206)
at
org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:430)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:361)
at
org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:768)

at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:383)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1070)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:722)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:703)
at
org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.jav
a:144)
at
mt.paraph.folder.report.ParaphFolderReport.mergeFiles(ParaphFolderReport.ja
va:72)
at
mt.paraph.folder.report.ParaphFolderReport.main(ParaphFolderReport.java:55)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message