Public Sub AnnCodecs_AnnCodecs(ByVal fileName As String)
Dim container As AnnContainer = New AnnContainer()
Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
rectObj.Bounds = New AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel)
rectObj.Pen = New AnnPen(Color.Blue, New AnnLength(1, AnnUnit.Pixel))
rectObj.Brush = Nothing
container.Objects.Add(rectObj)
Dim lineObj As AnnLineObject = New AnnLineObject()
lineObj.StartPoint = New AnnPoint(100, 100, AnnUnit.Pixel)
lineObj.EndPoint = New AnnPoint(200, 200, AnnUnit.Pixel)
lineObj.Pen = New AnnPen(Color.Red, New AnnLength(1, AnnUnit.Pixel))
container.Objects.Add(lineObj)
Dim codecs As AnnCodecs = New AnnCodecs()
codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite)
Dim information As AnnCodecsInformation = New AnnCodecsInformation()
codecs.GetInformation(fileName, information)
MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))
codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 2, AnnCodecsSavePageMode.Insert)
information = New AnnCodecsInformation()
codecs.GetInformation(fileName, information)
MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))
codecs.DeletePage(fileName, 1)
information = New AnnCodecsInformation()
codecs.GetInformation(fileName, information)
MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))
End Sub |