FlattenAnnotation Method (GdPicturePDF)
 
            
                In This Topic
            
            Flattens the required annotation specified by its index related to the currently selected page of the loaded PDF document. 
Flattening an annotation means removing the annotation object from the document's internal structure and placing its data within the PDF document as regular item, so the previously defined annotation is no longer available for user's interaction.
 
            
            
            Syntax
            
        
            Parameters
- AnnotationIdx
 
- The 0-based index of the required annotation within the current page. It must be a value from 0 to GdPicturePDF.GetAnnotationCount-1.
 
            
            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.
 
            
            
            
            
            
            Example
Flattening all annotations in the loaded PDF document.
            
             
    
	
		Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("input.pdf", False)
    Dim pageCount As Integer = gdpicturePDF.GetPageCount()
    For page As Integer = 1 To pageCount
        gdpicturePDF.SelectPage(page)
        Dim annotCount As Integer = gdpicturePDF.GetAnnotationCount()
        For i As Integer = 0 To annotCount - 1
            gdpicturePDF.FlattenAnnotation(0)
        Next
    Next
    gdpicturePDF.SaveToFile("output.pdf", True)
End Using
	 
	
		using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    gdpicturePDF.LoadFromFile("input.pdf", false);
    int pageCount = gdpicturePDF.GetPageCount();
    for (int page = 1; page <= pageCount; page++)
    {
        gdpicturePDF.SelectPage(page);
        int annotCount = gdpicturePDF.GetAnnotationCount();
        for (int i = 0; i < annotCount; i++)
        {
            gdpicturePDF.FlattenAnnotation(0);
        }
    }
    gdpicturePDF.SaveToFile("output.pdf", true);
}
	 
	
 
 
            
            Example
Flattening all annotations in the loaded PDF document.
            
            Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
                gdpicturePDF.LoadFromFile("input.pdf", False)
                Dim pageCount As Integer = gdpicturePDF.GetPageCount()
                For page As Integer = 1 To pageCount
                    gdpicturePDF.SelectPage(page)
                    Dim annotCount As Integer = gdpicturePDF.GetAnnotationCount()
                    For i As Integer = 0 To annotCount - 1
                        gdpicturePDF.FlattenAnnotation(0)
                    Next
                Next
                gdpicturePDF.SaveToFile("output.pdf", True)
            End Using
            using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
            {
                gdpicturePDF.LoadFromFile("input.pdf", false);
                int pageCount = gdpicturePDF.GetPageCount();
                for (int page = 1; page <= pageCount; page++)
                {
                    gdpicturePDF.SelectPage(page);
                    int annotCount = gdpicturePDF.GetAnnotationCount();
                    for (int i = 0; i < annotCount; i++)
                    {
                        gdpicturePDF.FlattenAnnotation(0);
                    }
                }
                gdpicturePDF.SaveToFile("output.pdf", true);
            }
            
            
            See Also