Deletes a page from an annotation file containing multiple pages.
fileName
Name of the annotation file.
page
Number of the page to delete. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.
This method can be used to remove annotation pages from a multi-page annotation file. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, and so on. This method can be used for all LEAD annotation file formats. To determine the format for a particular LEAD annotation file, use GetInformation(String,AnnCodecsInformation).
Note, you cannot delete a page from an annotation file that has only 1 page.
using Leadtools;using Leadtools.Annotations;using Leadtools.Codecs;using Leadtools.WinForms;public void AnnCodecs_DeletePage(string fileName){// create a new annotation containerAnnContainer container = new AnnContainer();// add a few objects into the containerAnnRectangleObject rectObj = 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 = null;container.Objects.Add(rectObj);AnnLineObject lineObj = 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);// create a new AnnCodecs classAnnCodecs codecs = new AnnCodecs();// save this container into a file// save the objects in this containercodecs.Save(fileName, container, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite);// get information about the fileAnnCodecsInformation information = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));// save the objects again (as a second page)codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 2, AnnCodecsSavePageMode.Insert);// get information about the fileinformation = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));// delete the first pagecodecs.DeletePage(fileName, 1);// get information about the fileinformation = new AnnCodecsInformation();codecs.GetInformation(fileName, information);MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages));}
Imports LeadtoolsImports Leadtools.AnnotationsImports Leadtools.CodecsImports Leadtools.WinFormsPublic Sub AnnCodecs_DeletePage(ByVal fileName As String)' create a new annotation containerDim container As AnnContainer = New AnnContainer()' add a few objects into the containerDim 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 = Nothingcontainer.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)' create a new AnnCodecs classDim codecs As AnnCodecs = New AnnCodecs()' save this container into a file' save the objects in this containercodecs.Save(fileName, container, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite)' get information about the fileDim information As AnnCodecsInformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))' save the objects again (as a second page)codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 2, AnnCodecsSavePageMode.Insert)' get information about the fileinformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))' delete the first pagecodecs.DeletePage(fileName, 1)' get information about the fileinformation = New AnnCodecsInformation()codecs.GetInformation(fileName, information)MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))End Sub
|
Products |
Support |
Feedback: DeletePage(String,Int32) Method - Leadtools.Annotations |
Introduction |
Help Version 19.0.2017.6.20
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.