[poppler] Problem understanding Optional Content

Leonard Rosenthol leonardr at pdfsages.com
Tue Nov 6 08:06:36 PST 2007


Optional Content is basically the application of boolean logic on  
pieces of a PDF during the rendering process.

The PDF provides a list of the OCGs (and OCMDs - OC Membership  
Dictionaries) and the viewer's job is to determine (at any given time  
during the viewing & printing process) which pieces of content (and  
annotations) should be shown or not.   In order to do this, you need  
to maintain the list of OCGs and their boolean expressions as well as  
whether they have any "auto states" (which determine whether a user- 
imposed condition such as the act of printing or zooming to a  
specific zoom factor change the expressions).

Then as you render, you need to check each piece of content to see if  
it lies inside of an OCG, and whether that OCG is "On" or "Off" at  
this time.

For PDF 1.5, when they were first introduced - the boolean  
expressions were quite simplistic.  However, in PDF 1.6, a new  
"Visibility Expression (VE)" was introduced that allows for quite  
complex expressions.

If you need any more samples or help - just holler!   It would be  
great to see a Poppler client support OCGs...

Leonard

On Nov 6, 2007, at 12:31 PM, Brad Hards wrote:

> Bug 12661 (https://bugs.freedesktop.org/show_bug.cgi?id=12661) is  
> about
> rendering layers that should be turned off.
>
> OK, I've since read section 4.10 of the PDF specification, but I  
> still don't
> understand exactly how the file is working.
>
> I do see how we get from the document Catalog to the OCProperties,  
> which
> layers are on or off by default, the absence of any radio buttons,  
> the names
> of the layers, the order and structure of the layers. In fact, I  
> think I
> understand almost everything except the for how an object is  
> actually decided
> to be rendered or not.
>
>  In particular, I don't see how any content (except for a few in  
> the group for
> Object 25) actually gets turned on or off.
>
> I do get this example:
> 33 0 obj<</Rect[51.0236 368.632 290.763 379.333]/Subtype/Link/BS<</ 
> S/S/W
> 0/Type/Border>>/OC 25 0 R/A 76 0 R/H/N/Border[0 0 0]/Type/ 
> Annot>>endobj
>
> I just don't see any other groups work - I only see the /OC  
> property for obj
> 25.
>
>
> I see this part (which I take it says MCx is somehow a name for obj  
> (19+x) ),
> but I can't see how the labels match up to anything:
> 31 0 obj<</CropBox[0.0 0.0 595.276 841.89]/Annots 32 0 R/Parent 13 0
> R/Contents[37 0 R 38 0 R 40 0 R 41 0 R 50 0 R 51 0 R 52 0 R 53 0 R]/ 
> Rotate
> 0/BleedBox[0.0 0.0 595.276 841.89]/ArtBox[0.0 0.0 595.276
> 841.89]/MediaBox[0.0 0.0 595.276 841.89]/TrimBox[0.0 0.0 595.276
> 841.89]/Resources<</XObject<</Im0 56 0 R/Im1 56 0 R/Im2 56 0 R/Im3  
> 56 0
> R>>/Shading<</Sh0 59 0 R/Sh1 63 0 R/Sh2 66 0 R>>/ColorSpace<</CS0  
> 35 0 R/CS1
> 35 0 R>>/Font<</T1_0 42 0 R/T1_1 43 0 R/T1_2 44 0 R/T1_3 45 0
> R>>/ProcSet[/PDF/Text/ImageB]/Properties<</MC0 19 0 R/MC1 20 0 R/ 
> MC2 21 0
> R/MC3<<>>/MC4 22 0 R/MC5 23 0 R/MC6 24 0 R/MC7<<>>/MC8 25 0 R/MC9 26 0
> R>>/ExtGState<</GS0 36 0 R/GS1 39 0 R/GS2 73 0 R/GS3 74 0 R/GS4 75 0
> R>>>>/Type/Page>>
> endobj
>
> Any suggestions?
>
> Brad
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list