Flatten and compress the page content stream.

 

   

Syntax
 

[C#]
void Flatten()
void Flatten(bool force)

[Visual Basic]
Sub Flatten()
Sub Flatten(force As Boolean)

 

   

Params
 
Name Description
force Whether to force the flattening even if the streams contain extra information which might be lost - default false.
return Whether the page is flat.

 

   

Notes
 

Objects added to a page are stored as individual layers. Calling this method combines all the layers on the current page and then re-compresses the layer data.

This method is the same as the Doc.Flatten method. However the 'force' parameter can be used to force the page to be flattened even when the Doc.Flatten method would be more cautious.

The Doc.Flatten method is cautious because different layers can be tagged with different information. Flattening the page will result in this type of information being lost. This type of tagging is not something that is defined in the PDF specification but it is possible that various third party applications may make use of proprietary techniques like this to add extra information to the document.

However for some types of operations a failure to flatten the page can be very inconvenient. For example it is possible to split PDF drawing operations over more than one content stream. If you are analyzing and updating a page using the Doc.GetText method to identify the locations of PDF operators, it can be very tiresome to deal with this type of construct.

 

   

Example
 

None.