Load any file for the annotation manager in C#
Any File
To load any type of file to the AnnotationManager
object, use the InitFromFile
method. This method requires the full path to a file as its parameter.
The list of supported file formats is available on the Supported File Types page.
The AnnotationManager
object only handles GdPicture and XMP annotations contained in the source document.
To load an image file to the AnnotationManager
object, use the following code:
using AnnotationManager annotationManager= new AnnotationManager();// Load an image to the `AnnotationManager` object.annotationManager.InitFromFile(@"C:\temp\source.jpg");// 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 into the image.annotationManager.BurnAnnotationsToPage(false);// Save the image with the annotation.annotationManager.SaveDocumentToJPEG(@"C:\temp\output.jpg", 100);
Using annotationManager As AnnotationManager = New AnnotationManager() ' Load an image to the `AnnotationManager` object. annotationManager.InitFromFile("C:\temp\source.jpg") ' 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 into the image. annotationManager.BurnAnnotationsToPage(False) ' Save the image with the annotation. annotationManager.SaveDocumentToJPEG("C:\temp\output.jpg", 100)End Using