Gets or sets a value that indicates whether to clone all the pages if the source image is multi-page.
Syntax
Visual Basic (Declaration) | |
---|
Public Property AllPages As Boolean |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As CloneCommand
Dim value As Boolean
instance.AllPages = value
value = instance.AllPages
|
C# | |
---|
public bool AllPages {get; set;} |
C++/CLI | |
---|
public:
property bool AllPages {
bool get();
void set (bool value);
} |
Return Value
true to clone all the pages if the source image is multi-page, otherwise;
false.
Example
This example will clone a multi-page image and shows the over-all progress value.
Visual Basic | Copy Code |
---|
Private Sub CloneAllTest()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
Dim image As RasterImage = Nothing
For i As Integer = 1 To 4
Dim pageImage As RasterImage = codecs.Load("C:\Users\Public\Documents\LEADTOOLS Images\OCR" + i.ToString() + ".tif")
If IsNothing(image) Then
image = pageImage
Else
image.AddPage(pageImage)
pageImage.Dispose()
End If
next
Console.WriteLine("Input image has {0} pages", image.PageCount)
Dim cloneCmd As New CloneCommand()
cloneCmd.AllPages = True
AddHandler cloneCmd.Progress, AddressOf cloneCmd_Progress
cloneCmd.Run(image)
RemoveHandler cloneCmd.Progress, AddressOf cloneCmd_Progress
Dim destinationImage As RasterImage = cloneCmd.DestinationImage
Console.WriteLine("Cloned image has {0} pages", destinationImage.PageCount)
destinationImage.Dispose()
image.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub
Private Sub cloneCmd_Progress(ByVal sender As Object, ByVal e As RasterCommandProgressEventArgs)
Dim cmd As CloneCommand = DirectCast(sender, CloneCommand)
Dim overallPercent As Integer
If cmd.AllPages AndAlso cmd.SourceImage.PageCount > 1 Then
overallPercent = ((cmd.SourceImage.Page - 1) * 100 + e.Percent) \ cmd.SourceImage.PageCount
Else
overallPercent = e.Percent
End If
Console.WriteLine("Current page completion: {0} of {1} - {2}% - Overall image completion {3}%", cmd.SourceImage.Page, cmd.SourceImage.PageCount, e.Percent, overallPercent)
End Sub |
C# | Copy Code |
---|
private void CloneAllTest() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); // Create a multi-page image for testing purposes RasterImage image = null; for(int i = 1; i <= 4; i++) { RasterImage pageImage = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\OCR" + i.ToString() + ".tif"); if(image == null) image = pageImage; else { image.AddPage(pageImage); pageImage.Dispose(); } } Console.WriteLine("Input image has {0} pages", image.PageCount); // Clone all pages CloneCommand cloneCmd = new CloneCommand(); cloneCmd.AllPages = true; cloneCmd.Progress += new EventHandler<RasterCommandProgressEventArgs>(cloneCmd_Progress); cloneCmd.Run(image); cloneCmd.Progress -= new EventHandler<RasterCommandProgressEventArgs>(cloneCmd_Progress); RasterImage destinationImage = cloneCmd.DestinationImage; Console.WriteLine("Cloned image has {0} pages", destinationImage.PageCount); destinationImage.Dispose(); image.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } private void cloneCmd_Progress(object sender, RasterCommandProgressEventArgs e) { // By using the SourceImage property of the CloneCommand we can find out // the progress for the current page as well as the overall CloneCommand cmd = sender as CloneCommand; int overallPercent; if(cmd.AllPages && cmd.SourceImage.PageCount > 1) { // For multiple-pages, the command will fire the Progress event from 0 to 100 for each page // Use the source image Page property to find out where we are in overall completetion overallPercent = ((cmd.SourceImage.Page - 1) * 100 + e.Percent) / cmd.SourceImage.PageCount; } else { // Otherwise, the percent is the same as the current page overallPercent = e.Percent; } Console.WriteLine("Current page completion: {0} of {1} - {2}% - Overall image completion {3}%", cmd.SourceImage.Page, cmd.SourceImage.PageCount, e.Percent, overallPercent); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also