Hi,

Am 10.12.2010 19:48, schrieb Kevin Brown:
I just tried the reverse -- creating the CosDocument before creating the
PDDocument, and still no dice. The version stays the same. Perhaps this is a
bug?

             File file = new File(args[1]);
             PDFParser parser = new PDFParser(new FileInputStream(file));
             parser.parse();
             cos = parser.getDocument();
             cos.setVersion((float) 1.8);
             PDDocument document = new PDDocument(cos);
             document.save(args[1]+"b");
             document.close();

First of all you should use something like the following to load a pdf

        PDDocument document = PDDocument.load("test.pdf");

To get/set the version you should use something like this

        document.getDocumentCatalog.getVersion();
        document.getDocumentCatalog.setVersion("1.5");

I didn't try the second recently but it should work.


BR
Andreas Lehmkühler

Reply via email to