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();

On Fri, Dec 10, 2010 at 1:08 PM, Kevin Brown <[email protected]> wrote:

> I don't seem to be able to get CosDocument.setVersion() to work. Where
> Document is a PDDocument, I get the COSDocument.... anyone had any luck with
> this? Am I doing something wrong? If I call getVersion() before changing it,
> I get the old version, and if I call getVersion() after I changed the
> version I get the new version. But when I save and open the file in Reader,
> it's the old version I see.
>
>   COSDocument cos = document.getDocument();
>            System.out.println("got cos " + cos.getVersion());
>                cos.setVersion((float) 1.8);
>
>
>
>             document.save(args[1]);
>
>               cos.close();
>
>
>
>              document.close();
>
>
> On Fri, Dec 10, 2010 at 12:11 PM, Kevin Brown <[email protected]> wrote:
>
>> Ah, sorry, I see you can set the version with the method:
>>
>> COSDocument.setVersion()
>>
>> I'll see if that helps!
>>
>>
>>
>>
>> On Fri, Dec 10, 2010 at 12:05 PM, Kevin Brown <[email protected]> wrote:
>>
>>> It seems like just saving a simple PDF (which was generated by Adobe
>>> Acrobat 9 Web Capture) with PDFBox PDDocument.save method will balloon the
>>> file size. We can fix it by opening the file in Adobe Acrobat 9 and then
>>> saving it.  Is there any way to control this in PDFBox?
>>>
>>> Is there a way to set the PDF version programagically? We were thinking
>>> perhaps this might help.
>>>
>>> Thanks,
>>>
>>> Kevin
>>>
>>>
>>
>>
>

Reply via email to