pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Ternes <KTer...@thegeneral.com>
Subject PDDocument unreadable in Acrobat 7 after simple load/save
Date Thu, 08 Oct 2015 19:27:05 GMT
I am working with a file using pdfbox-2.0.0-20151007.203054-1746 and I can open both the input
and output file with Acrobat Reader XI.
According to Acrobat Reader for both input and output documents, PDF Version 1.6 (Acrobat
7.x)

I have a user reporting that she can open the input file, but cannot open the output version
of that file.
She gets a popup on the processed file from Acrobat saying "There was an error opening this
document. The file is damaged and could not be repaired."
She is using Acrobat Reader 7 on Win7 64-bit SP1.

I have reduced the problem down to the following load/save and we still get the error on the
saved file:
public class PDFBoxRunLoadSave {
  public static void main(String[] args) {
    PDDocument pdDocumentA = null;
    try {
        pdDocumentA = PDDocument.load(new File("CancelPolicy-0.pdf"));
        pdDocumentA.save("CancelPolicy-1.pdf");
    } catch (Exception ex) {
        System.err.println("Caught " + ex);
        ex.printStackTrace();
    } finally {
        close(pdDocumentA);
    }
  }

  static void close(PDDocument doc) {
    if (null != doc) {
      try { doc.close(); } catch (Exception ex) {
        System.out.println("Closing, caught " + ex);
      }
    }
  }
}

And here are the loaded and saved files:
Load: https://dl.dropboxusercontent.com/u/3103884/dev/CancelPolicy-0.pdf  17KB
Save: https://dl.dropboxusercontent.com/u/3103884/dev/CancelPolicy-1.pdf   21KB (why is the
output larger?)

Is it possible that PDFBox is breaking the output file in a way that Acrobat 7 cannot read
it but Acrobat XI can?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message