Occurs multiple times for each page loaded from an image file.
public event EventHandler<CodecsPageEventArgs> LoadPage
Public Event LoadPage As EventHandler(Of CodecsPageEventArgs)
synchronized public void addLoadPageListener(CodecsLoadPageListener listener)
synchronized public void removeLoadPageListener(CodecsLoadPageListener listener)
public:
event EventHandler<CodecsPageEventArgs^>^ LoadPage
The event handler receives an argument of type CodecsPageEventArgs containing data related to this event. The following CodecsPageEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Command | A value indicating how the load or save process should continue. |
This event will fire multiple times for each page loaded with any of the Load and LoadAsync methods. The user should check the State property. You can use this event to get information about the image pages being loaded or to skip loading certain pages.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
private void Codecs_LoadSavePage(object sender, CodecsPageEventArgs e)
{
if (e.State == CodecsPageEventState.After)
Console.WriteLine("The image has been processed");
else
Console.WriteLine("The image has not processed yet");
if (e.Page > 5)
e.Command = CodecsPageEventCommand.Stop;
Console.WriteLine("File name is: {0}", e.FileName);
if (e.Image != null)
Console.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height);
Console.WriteLine("Page Index is: {0}", e.Page);
Console.WriteLine("Page Count is: {0}", e.PageCount);
}
public void LoadPageExample()
{
RasterCodecs codecs = new RasterCodecs();
codecs.LoadPage += new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
codecs.SavePage += new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"));
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "loadsave.jpg"), RasterImageFormat.Jpeg, image.BitsPerPixel);
codecs.LoadPage -= new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
codecs.SavePage -= new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
// Clean up
codecs.Dispose();
image.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg
Private Sub Codecs_LoadSavePage(ByVal sender As Object, ByVal e As CodecsPageEventArgs)
If e.State = CodecsPageEventState.After Then
Console.WriteLine("The image has been processed")
Else
Console.WriteLine("The image has not processed yet")
End If
If e.Page > 5 Then
e.Command = CodecsPageEventCommand.Stop
End If
Console.WriteLine("File name is: {0}", e.FileName)
If Not e.Image Is Nothing Then
Console.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height)
End If
Console.WriteLine("Page Index is: {0}", e.Page)
Console.WriteLine("Page Count is: {0}", e.PageCount)
End Sub
Public Sub LoadPageExample()
Dim codecs As RasterCodecs = New RasterCodecs()
AddHandler codecs.LoadPage, AddressOf Codecs_LoadSavePage
AddHandler codecs.SavePage, AddressOf Codecs_LoadSavePage
Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"))
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "loadsave.jpg"), RasterImageFormat.Jpeg, image.BitsPerPixel)
RemoveHandler codecs.LoadPage, AddressOf Codecs_LoadSavePage
RemoveHandler codecs.SavePage, AddressOf Codecs_LoadSavePage
' Clean up
codecs.Dispose()
image.Dispose()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
c#[Silverlight C# Example]
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Examples;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Windows.Media;
private void Codecs_LoadSavePage(object sender, CodecsPageEventArgs e)
{
if (e.State == CodecsPageEventState.After)
Debug.WriteLine("The image has been processed");
else
Debug.WriteLine("The image has not processed yet");
if (e.Page > 5)
e.Command = CodecsPageEventCommand.Stop;
Debug.WriteLine("File name is: {0}", e.FileName);
if (e.Image != null)
Debug.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height);
Debug.WriteLine("Page Index is: {0}", e.Page);
Debug.WriteLine("Page Count is: {0}", e.PageCount);
}
public void LoadPageExample(Stream inStream, Stream outStream)
{
RasterCodecs codecs = new RasterCodecs();
codecs.LoadPage += new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
codecs.SavePage += new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
RasterImage image = codecs.Load(inStream);
codecs.Save(image, outStream, RasterImageFormat.Jpeg, image.BitsPerPixel);
codecs.LoadPage -= new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
codecs.SavePage -= new EventHandler<CodecsPageEventArgs>(Codecs_LoadSavePage);
// Clean up
image.Dispose();
}
vb[Silverlight VB Example]
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Windows.Media
Private Sub Codecs_LoadSavePage(ByVal sender As Object, ByVal e As CodecsPageEventArgs)
If e.State = CodecsPageEventState.After Then
Debug.WriteLine("The image has been processed")
Else
Debug.WriteLine("The image has not processed yet")
End If
If e.Page > 5 Then
e.Command = CodecsPageEventCommand.Stop
End If
Debug.WriteLine("File name is: {0}", e.FileName)
If Not e.Image Is Nothing Then
Debug.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height)
End If
Debug.WriteLine("Page Index is: {0}", e.Page)
Debug.WriteLine("Page Count is: {0}", e.PageCount)
End Sub
Public Sub LoadPageExample(ByVal inStream As Stream, ByVal outStream As Stream)
Dim codecs As RasterCodecs = New RasterCodecs()
AddHandler codecs.LoadPage, AddressOf Codecs_LoadSavePage
AddHandler codecs.SavePage, AddressOf Codecs_LoadSavePage
Dim image As RasterImage = codecs.Load(inStream)
codecs.Save(image, outStream, RasterImageFormat.Jpeg, image.BitsPerPixel)
RemoveHandler codecs.LoadPage, AddressOf Codecs_LoadSavePage
RemoveHandler codecs.SavePage, AddressOf Codecs_LoadSavePage
' Clean up
image.Dispose()
End Sub
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document