Hi,

Am 10.12.2010 20:11, schrieb Kevin Brown:
Thanks, Andreas.

I was using the load method originally to get the PDDocument. I was just
trying other things to see if anything suck to the wall.

There is no PDDocument.getDocumentCatelog.setVersion() method. There is a
PDDocument.getDocument().setVersion(1.7) method. I can't get that to work.
Have you done this kind of thing before?

I'm pretty sure there is such method. Try this:

PDDocument document = PDDocument.load("test.pdf");
document.getDocumentCatalog().setVersion("1.5");


BR
Andreas Lehmkühler




On Fri, Dec 10, 2010 at 2:07 PM, Andreas Lehmkuehler<[email protected]>wrote:

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