You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Kevin Brown <kb...@gmail.com> on 2010/12/10 22:34:12 UTC
Have you been able to use setVersion() method of CosDocument?
If you have, would you mind sharing a snippet of code showing how?
I guess I'll file a bug report if I don't hear from anyone in the next few
days. I'm fairly sure it's a bug, but surely some one else would have
noticed if you couldn't set the version. I don't see anything in the bug
list about this -- one guy had a problem with getVersion(), but this seems
to be working fine now.
On Fri, Dec 10, 2010 at 2:11 PM, Kevin Brown <kb...@gmail.com> wrote:
> 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?
>
>
>
> On Fri, Dec 10, 2010 at 2:07 PM, Andreas Lehmkuehler <an...@lehmi.de>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
>>
>
>