BurnAnnotationsToPage(Boolean,Boolean) Method
In This Topic
Burn, in other words flatten, the GdPicture/XMP annotations into the selected page of the document currently handled by this AnnotationManager object.
Burning (flattening) annotations means simply including them directly into the content of the page, to which they belong, so they are not more editable. This will permanently write an annotation into the document, so it is not considered as an annotation anymore.
This method supports custom annotations burning by setting the VectorMode parameter to false. In other words, this way annotations are drawn using raster graphics (rasterized) on the page.
Syntax
'Declaration
Public Overloads Function BurnAnnotationsToPage( _
ByVal As Boolean, _
ByVal As Boolean _
) As GdPictureStatus
public GdPictureStatus BurnAnnotationsToPage(
bool ,
bool
)
public function BurnAnnotationsToPage(
: Boolean;
: Boolean
): GdPictureStatus;
public function BurnAnnotationsToPage(
: boolean,
: boolean
) : GdPictureStatus;
public: GdPictureStatus BurnAnnotationsToPage(
bool ,
bool
)
public:
GdPictureStatus BurnAnnotationsToPage(
bool ,
bool
)
Parameters
- RemoveInitialAnnots
- Set this parameter to true, if you want to remove the initial annotation blob content from the file, otherwise set it to false.
- VectorMode
- Determines, if annotations data are rendered in vector format (means using vector graphics) on the page. Setting this parameter to false
is only suitable for burning annotations into PDF documents in order to rasterize them on the page, that means to produce image-based page content.
At the same, custom annotations can only be burned if the VectorMode parameter is set to false using the same approach.
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
How to burn your annotations (specifically custom annotations) contained in your PDF document using rasterization.
Using annotationManager As AnnotationManager = New AnnotationManager()
'We assume that you have already annotated your source document.
If annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK Then
Dim status As GdPictureStatus = GdPictureStatus.OK
For i As Integer = 1 To annotationManager.PageCount
status = annotationManager.SelectPage(i)
If status = GdPictureStatus.OK Then
'Burning annotations to page using rasterization.
status = annotationManager.BurnAnnotationsToPage(True, False)
If status <> GdPictureStatus.OK Then Exit For
Else
Exit For
End If
Next
If status = GdPictureStatus.OK Then
If annotationManager.SaveDocumentToPDF("dest.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.BurnAnnotationsToPage")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.BurnAnnotationsToPage")
End If
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.BurnAnnotationsToPage")
End If
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.BurnAnnotationsToPage")
End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
//We assume that you have already annotated your source document.
if (annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK)
{
GdPictureStatus status = GdPictureStatus.OK;
for (int i = 1; i <= annotationManager.PageCount; i++)
{
status = annotationManager.SelectPage(i);
if (status == GdPictureStatus.OK)
{
//Burning annotations to page using rasterization.
status = annotationManager.BurnAnnotationsToPage(true, false);
if (status != GdPictureStatus.OK) break;
}
else
break;
}
if (status == GdPictureStatus.OK)
{
if (annotationManager.SaveDocumentToPDF("dest.pdf") == GdPictureStatus.OK)
MessageBox.Show("Done!", "AnnotationManager.BurnAnnotationsToPage");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.BurnAnnotationsToPage");
}
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.BurnAnnotationsToPage");
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.BurnAnnotationsToPage");
}
See Also