GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / FlattenVisibleOCGs Method
Example





FlattenVisibleOCGs Method (GdPicturePDF)
Flattens all visible optional content group entries and removes content of all hidden ones in the currently loaded PDF document. That means content of all visible layers is flattened into the document and content of all hidden layers is removed.
Syntax
'Declaration
 
Public Function FlattenVisibleOCGs() As GdPictureStatus
 

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
Flattening all visible layers and removing all hidden ones included in the current document.
Using gdpicturePdf As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("document.pdf", False)
    gdpicturePDF.FlattenVisibleOCGs()
    MessageBox.Show("The number of layers available: " + gdpicturePDF.GetOCGCount(), "Flattening visible layers", MessageBoxButtons.OK, MessageBoxIcon.Information)
    gdpicturePDF.SaveToFile("output.pdf")
End Using
See Also