pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petras Petkus" <petras.pet...@mitsoft.lt>
Subject RE: COSDocument returns incorrect version from header string
Date Fri, 19 Feb 2016 06:58:02 GMT
Dear Tilman,

Yes, we need the original header string. Your proposal to obtain it is
completely fine to us (as I also prefer that upon document save the header
string would be aligned with the version set in catalog). Thank you!

Petras


-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Thursday, February 18, 2016 9:17 PM
To: users@pdfbox.apache.org
Subject: Re: COSDocument returns incorrect version from header string

Sorry, I didn't read your original text closely enough. So what you need is
the header version, unmodified, right?

 From a quick look in 2.0 I think it is solved better there, but not in 1.8.

How about something like this:

private String originalHeaderString = null;

public void setOriginalHeaderString(String header)
     {
         if (originalHeaderString != null)
               throw bad state exception blah blah
         originalHeaderString = header;
     }

public String getOriginalHeaderString()
{
     return originalHeaderString ;
}


The setter should be called only once by parseHeader().


Tilman



Am 18.02.2016 um 18:02 schrieb Petras Petkus:
> Yes, I know, that the version in catalog shall be used to determine 
> version and therefore the version COSDocument#getVersion() method 
> result is expected to reflect that. But I ask the header string. And 
> it's result differs from the actual header string in the file after
PDFParser finishes its job.
>
> Please, bear also in mind that Extensions Dictionary (see ISO 32000-1 
> chapter 7.12) validation should consider the values both in document 
> catalog and header:
> "The value of BaseVersion, when treated as a version number, shall be 
> less than or equal to the PDF version, both in the document header 
> (see 7.5.2, "File Header") and the catalog Version key value, if present."
>
> As it says "both", that means BaseVersion may not exceed the value 
> neither in header nor in catalog, therefore we need to validate that.
>
> Petras
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Thursday, February 18, 2016 6:28 PM
> To: users@pdfbox.apache.org
> Subject: Re: COSDocument returns incorrect version from header string
>
>
>
> Am 18.02.2016 um 09:30 schrieb Petras Petkus:
>> Hello,
>>
>>    
>>
>> We are using the latest v1.8.12-SNAPSHOT and we noticed, that
>> COSDocument#getHeaderString() method does not return the version 
>> indicated in PDF header string, but the version set document catalog 
>> (see
>> COSDocument#serVersion() which updates header string). Is such side 
>> effect behavior intentional?
>
> Yes.
>
> See 7.5.2 File Header in the "32000" specification:
>
> Beginning with PDF 1.4, the Version entry in the document's catalog 
> dictionary (located via the Root entry in the file's trailer, as 
> described in 7.5.5, "File Trailer"), if present, shall be used instead 
> of the version specified in the Header.
>
>
> Tilman
>
>
>>    
>>
>> We have validation scenarios (national PDF-based document 
>> specification), where version of the header string is checked. In 
>> present situation we fail to correctly validate, if header string 
>> version is overridden by value in catalog.
>>
>>    
>>
>> Petras
>>
>>    
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message