Hi Johan,

to best of my knowledge

a) Fast Web View / Linearization
 PDFBox doesn't have specific code for linearization so something like 
isLinearized() or isFastWebView() is not available. In order to find out for 
yourself if a pdf is linearized you can look up the existence of a 
linearization parameter dictionary which must exist within the first 1024 bytes 
of the pdf. The layout is like this:

<< /Linearized 1.0 % Version
        /L 54567 % File length
        /H [475 598]  % Primary hint stream offset and length (part 5)
        /O 45 % Object number of first page’s page object (part 6)
        /E 5437 % Offset of end of first page
        /N 11 % Number of pages in document 
        /T 52786 % Offset of first entry in main cross-reference table (part 
11) 
>> 

The complete spec can be found in Annex F of  ISO-32000


b) Compressed stream objects
PDFBox does deal with compressed stream objects just fine. Unfortunately there 
is currently no document info I know of which is set if a compressed stream 
object is encountered.

c) Commenting
Please review
http://pdfbox.apache.org/apidocs/org/apache/pdfbox/pdmodel/PDDocument.html#getCurrentAccessPermission%28%29
 and 
http://pdfbox.apache.org/apidocs/org/apache/pdfbox/pdmodel/encryption/AccessPermission.html

With kind regards

Maruan Sahyoun


> Hi, am still hoping for help on if PDFBox can determine these attributes. 
> Thanks again ----- Original Message -----
> | Hi All,
> | How can I determine in Java if a PDF file matches these requirements?
> | • The file is optimized for Fast Web Viewing.
> | • The file does not contain compressed stream objects.
> | • The Document restrictions allow Commenting. // Am using
> | ap.canModifyAnnotations()

Reply via email to