pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Vacondio <andrea.vacon...@gmail.com>
Subject Question about PDDocument.setVersion
Date Wed, 04 Mar 2015 13:15:42 GMT
Hi, about 2.0.0-SNAPSHOT I was setting version on an existing document and
I noticed the version was set on the Catalog but not in the header so I
took a look at the code and I think there's something odd there (or I'm
missing something).
It first makes sure we are not downgrading the version and then we have the
following code (see my comment):

        if (newVersion >= 1.4f)
        {
            getDocumentCatalog().setVersion(Float.toString(newVersion));
//isn't this always false? We already know newVersion is greater...
            if (getDocument().getVersion() > newVersion)
            {
                getDocument().setVersion(newVersion);
            }
        }
        else
        {
            // versions < 1.4f have a version header only
            getDocument().setVersion(newVersion);
        }

I'm not fully sure what's the expected behaviour but I guess it's something
like "if newVer is less then 1.4 then set the header else set both header
and catalog so something like:
if (newVersion >= 1.4f)
        {

getDocumentCatalog().setVersion(Float.toString(newVersion));
        }
            getDocument().setVersion(newVersion);

Am I missing something?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message