Save a file from the annotation manager in C#
To TIFF
To save a document created with the AnnotationManager
class to a TIFF image with GdPicture XMP annotation support, use the SaveDocumentToTIFF
method. It can save the document to a file or a Stream
object
and uses the following parameters:
- Either
FilePath
orStream
— The destination of the document you want to save, either to a file or aStream
. Compression
— A member of theTiffCompression
enumeration. It specifies the compression method.
To include the annotations in the document’s content, use the BurnAnnotationsToPage
method.
To save a TIFF image from the AnnotationManager
object, use the following code:
using AnnotationManager annotationManager= new AnnotationManager();// Load a TIFF image to the `AnnotationManager` object.annotationManager.InitFromFile(@"C:\temp\source.tiff");
// Select the first page.annotationManager.SelectPage(1);
// Create an `AnnotationRubberStamp` object.GdPicture14.Annotations.AnnotationRubberStamp stamp;// Add the stamp to the `AnnotationManager` object.stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");stamp.Rotation = 20;// Save the annotation to the `AnnotationManager` object.annotationManager.SaveAnnotationsToPage();// Flatten the annotation.annotationManager.BurnAnnotationsToPage(false);// Save the document as a TIFF image.annotationManager.SaveDocumentToTIFF(@"C:\temp\output.tiff", 100);
Using annotationManager As AnnotationManager = New AnnotationManager() ' Load a TIFF image to the `AnnotationManager` object. annotationManager.InitFromFile("C:\temp\source.tiff")
' Select the first page. annotationManager.SelectPage(1)
' Create an `AnnotationRubberStamp` object. Dim stamp As GdPicture14.Annotations.AnnotationRubberStamp ' Add the stamp to the `AnnotationManager` object. stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5F, 0.5F, 2, 1, "APPROVED") stamp.Rotation = 20 ' Save the annotation to the `AnnotationManager` object. annotationManager.SaveAnnotationsToPage() ' Flatten the annotation. annotationManager.BurnAnnotationsToPage(False) ' Save the document as a TIFF image. annotationManager.SaveDocumentToTIFF("C:\temp\output.tiff", 100)End Using