Gets or sets the current active page for this
RasterImage.
Syntax
Visual Basic (Declaration) |
|
Public Property Page As Integer |
Visual Basic (Usage) |
Copy Code |
Dim instance As RasterImage
Dim value As Integer
instance.Page = value
value = instance.Page
|
C# |
|
public int Page {get; set;} |
C++/CLI |
|
public:
property int Page {
int get();
void set (int value);
} |
Return Value
The 1-based index of the current page for this
RasterImage.
Example
This example demonstrates how to deal with multi-page RasterImage objects.
Visual Basic |
Copy Code |
Public Sub PagesExample() RasterCodecs.Startup() Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName1 As String = LeadtoolsExamples.Common.ImagesPath.Path + "eye.gif" Dim srcFileName2 As String = LeadtoolsExamples.Common.ImagesPath.Path + "image1.cmp"
Dim srcImage As RasterImage = codecs.Load(srcFileName1)
Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Active page: {0}", srcImage.Page) srcImage.Page = 3 Console.WriteLine("Active page: {0}", srcImage.Page) srcImage.Page = 1
Dim pageImage As RasterImage = codecs.Load(srcFileName2) Console.WriteLine("Adding a single page") srcImage.AddPage(pageImage) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
pageImage = codecs.Load(srcFileName1) Console.WriteLine("Adding multi-pages") srcImage.AddPages(pageImage, 1, 2) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Inserting a page") srcImage.InsertPage(4, pageImage) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Inserting pages") srcImage.InsertPages(0, pageImage, 1, -1) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Removing a page") srcImage.RemovePageAt(1) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Removing pages") srcImage.RemovePages(srcImage.PageCount - 3, -1) Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
Console.WriteLine("Removing all pages") srcImage.RemoveAllPages() Console.WriteLine("Pages in the image: {0}", srcImage.PageCount)
srcImage.Dispose() codecs.Dispose() RasterCodecs.Shutdown() End Sub |
C# |
Copy Code |
public void PagesExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); string srcFileName1 = LeadtoolsExamples.Common.ImagesPath.Path + "eye.gif"; string srcFileName2 = LeadtoolsExamples.Common.ImagesPath.Path + "image1.cmp"; // Load the multi-page image RasterImage srcImage = codecs.Load(srcFileName1); // Show the number of pages in this file Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Show and change the active page Console.WriteLine("Active page: {0}", srcImage.Page); srcImage.Page = 3; Console.WriteLine("Active page: {0}", srcImage.Page); srcImage.Page = 1; // Load a single page image and add it to the end RasterImage pageImage = codecs.Load(srcFileName2); Console.WriteLine("Adding a single page"); srcImage.AddPage(pageImage); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Load a multi page image and add a few pages to this image pageImage = codecs.Load(srcFileName1); Console.WriteLine("Adding multi-pages"); srcImage.AddPages(pageImage, 1, 2); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Insert a page in the middle Console.WriteLine("Inserting a page"); srcImage.InsertPage(4, pageImage); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Insert the rest of the pages at the beginning Console.WriteLine("Inserting pages"); srcImage.InsertPages(0, pageImage, 1, -1); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Remove the first page Console.WriteLine("Removing a page"); srcImage.RemovePageAt(1); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Remove the last 3 pages Console.WriteLine("Removing pages"); srcImage.RemovePages(srcImage.PageCount - 3, -1); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); // Remove all the pages (leaves 1) Console.WriteLine("Removing all pages"); srcImage.RemoveAllPages(); Console.WriteLine("Pages in the image: {0}", srcImage.PageCount); srcImage.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also