Andreas,

I generated 3 test documents.

LoremIpsum.pdf a two page PDF document output from Lorem Ipsum web page.
http://ceratopsian.net/pdf/LoremIpsum.pdf

GeneratedLoremIpsum.pdf is a second PDF document generated using print to PDF 
from Microsoft Word.
http://ceratopsian.net/pdf/GeneratedLoremIpsum.pdf

CombinedLoremIpsum.pdf was created using Acrobat Pro to open LoremIpsum.pdf 
then inserting GeneratedLoremIpsum.pdf after the second page.
http://ceratopsian.net/pdf/CombinedLoremIpsum.pdf

I then ran the FindActionLinks code below stripped down to load then save a new 
PDF file against all three files. The single documents, LoremIpsum.df and 
GeneratedLoremIpsum.pdf generated files that can be opened without error.
http://ceratopsian.net/pdf/new-LoremIpsum.pdf
http://ceratopsian.net/pdf/new-GeneratedLoremIpsum.pdf

The file generated from the CombinedLoremIpsum.pdf generates an error when 
opened. 
The file “new-CombinedLoremIpsum.pdf” could not be opened. It may be damaged or 
use a file format that Preview doesn’t recognize.
http://ceratopsian.net/pdf/new-CombinedLoremIpsum.pdf

-Chris

On Mar 29, 2013, at 4:31 AM, Andreas Lehmkuehler wrote:

> Hi,
> 
> Am 28.03.2013 05:43, schrieb Chris J Lindberg:
>> Additional information: The error occurred on Norwegian documents. I just 
>> tested outputting two English Word documents as PDF then combined the two 
>> using Acrobat Pro then ran the code below. The result gave me the same error 
>> when trying to open the output file using Preview.
>> 
>> On Mar 27, 2013, at 6:05 PM, Chris J Lindberg wrote:
>> 
>>> 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?
> That's hard without having a hand on the pdf in question.
> 
>>> Thanks,
>>> 
>>> Chris
> 
> BR
> Andreas Lehmkühler
> 

Reply via email to