pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris J Lindberg <...@lindbergarts.com>
Subject Error when opening multi-page PDF generated by PDFBox
Date Thu, 28 Mar 2013 01:05:22 GMT
Hello,

I generated a multi page document using Acrobat Pro by opening one PDF document then using
insert from file to add a second page. My goal was to switch launch links to go to links but
early on I got an error when trying to open the PDFBox generated file with either Preview
or Acrobat:

The file “NEW_AllPages.pdf” could not be opened. 
It may be damaged or use a file format that Preview doesn’t recognize.

I stripped out all of the link code and ran the following where I load the input file and
output a file based on command line arguments.

public class FindActionLinks {

    private static void usage() {
        System.err.println( "usage: " + FindActionLinks.class.getName() + " <input-file>
<output-file>" );
    }

    public static void main(String[] args) throws Exception {
        PDDocument doc = null;

        try {
            if (args.length != 2) {
                usage();
            } else {
                doc = PDDocument.load(args[0]);
                
                doc.save( args[1] );
            }            
        } finally {
            if (doc != null) {
                doc.close();
            }
        }
    }
}

After running this code I the error was the same. I then ran the code on a single PDF document
that had no inserted pages from file. Is this a bug? Any idea on how to correct this?

Thanks,

Chris
Mime
View raw message