Hi.  When I save a PDF document in my application, I get a COSVisitorException: 
"The handle is invalid".

        However, I do not see anything wrong with it.  I show the error, the 
string I am giving the PDDocument.save() method, and the code that attempts to 
save the file.

        Any idea what I am doing wrong?                Thanks, Alan 

OutPath = C:\Users\Alan\Documents\My Stuff\X Y Z Stuff\Application\Java App 
Test\New Folder\InsertedPages 2.pdf

org.apache.pdfbox.exceptions.COSVisitorException: The handle is invalid
        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:361)
        at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1070)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:787)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:768)


                    // Save and close the output file
                    if (OutputDoc != null)
                    {
                        System.out.println("OutPath = " + OutPath);
                        OutputDoc.save(OutPath);
                    }
                    OutputDoc.close();

Reply via email to