Hi,

Am 10.12.2010 23:05, schrieb Kevin Brown:
No, there really isn't a method by that name in PDFBox 1.3.1
I'm sorry, my fault. You're of course right. setVersion() was introduced just after releasing 1.3.1 [1] So, you have to use the current trunk or have to wait until the next release.


BR
Andreas Lehmkühler

[1] http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java?view=log

Thanks for responding, though. :)

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

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