Leadtools.Windows.Annotations Requires Document/Medical license. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
DeletePage(String,Int32) Method
See Also  Example
Leadtools.Windows.Annotations Namespace > AnnCodecs Class > DeletePage Method : DeletePage(String,Int32) Method



fileName
Name of the annotation file.
page
Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.
fileName
Name of the annotation file.
page
Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.
Deletes a page from an annotation file containing multiple pages.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub DeletePage( _
   ByVal fileName As String, _
   ByVal page As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As AnnCodecs
Dim fileName As String
Dim page As Integer
 
instance.DeletePage(fileName, page)
C# 
public void DeletePage( 
   string fileName,
   int page
)
C++/CLI 
public:
void DeletePage( 
   String^ fileName,
   int page
) 

Parameters

fileName
Name of the annotation file.
page
Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

Example

Visual BasicCopy Code
Public Sub AnnCodecs_DeletePage(ByVal fileName As String)
  ' create a new annotation container
  Dim container As AnnContainer = New AnnContainer()
  ' add a few objects into the container
  Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
  rectObj.Left = 100
  rectObj.Top = 100
  rectObj.Width = 100
  rectObj.Height = 100
  rectObj.Stroke = Brushes.Blue
  rectObj.StrokeThickness = 1.0
  rectObj.Fill = Nothing
  container.Children.Add(rectObj)

  Dim lineObj As AnnLineObject = New AnnLineObject()
  lineObj.X1 = 100
  lineObj.Y1 = 100
  lineObj.X2 = 200
  lineObj.Y2 = 200
  lineObj.Stroke = Brushes.Red
  lineObj.StrokeThickness = 1.0
  container.Children.Add(lineObj)

  ' create a new AnnCodecs class
  Dim codecs As AnnCodecs = New AnnCodecs()

  ' save this container into a file
  ' save the objects in this container
  codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite)

  ' get information about the file
  Dim 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 file
  information = New AnnCodecsInformation()
  codecs.GetInformation(fileName, information)
  MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))

  ' delete the first page
  codecs.DeletePage(fileName, 1)

  ' get information about the file
  information = New AnnCodecsInformation()
  codecs.GetInformation(fileName, information)
  MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages))
End Sub
C#Copy Code
public void AnnCodecs_DeletePage(string fileName) 

   // create a new annotation container 
   AnnContainer container = new AnnContainer(); 
   // add a few objects into the container 
   AnnRectangleObject rectObj = new AnnRectangleObject(); 
   rectObj.Left = 100; 
   rectObj.Top = 100; 
   rectObj.Width = 100; 
   rectObj.Height = 100; 
   rectObj.Stroke = Brushes.Blue; 
   rectObj.StrokeThickness = 1.0; 
   rectObj.Fill = null; 
   container.Children.Add(rectObj); 
 
   AnnLineObject lineObj = new AnnLineObject(); 
   lineObj.X1 = 100; 
   lineObj.Y1 = 100; 
   lineObj.X2 = 200; 
   lineObj.Y2 = 200; 
   lineObj.Stroke = Brushes.Red; 
   lineObj.StrokeThickness = 1.0; 
   container.Children.Add(lineObj); 
 
   // create a new AnnCodecs class 
   AnnCodecs codecs = new AnnCodecs(); 
 
   // save this container into a file 
   // save the objects in this container 
   codecs.Save(fileName, container, AnnCodecsFormat.Serialize, 1, AnnCodecsSavePageMode.Overwrite); 
 
   // get information about the file 
   AnnCodecsInformation 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 file 
   information = new AnnCodecsInformation(); 
   codecs.GetInformation(fileName, information); 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)); 
 
   // delete the first page 
   codecs.DeletePage(fileName, 1); 
 
   // get information about the file 
   information = new AnnCodecsInformation(); 
   codecs.GetInformation(fileName, information); 
   MessageBox.Show(String.Format("Format: {0}, Number of pages: {1}", information.Format, information.Pages)); 
}

Remarks

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.

Note, you cannot delete a page from an annotation file that has only 1 page.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also

DeletePage(String,Int32) requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.