Supports printing for images inside an Leadtools.Windows.Controls.ImageBox, Leadtools.Windows.Controls.RasterImageBox, Leadtools.Windows.Controls.ImageViewer or Leadtools.Windows.Controls.RasterImageViewer controls.
public class PrinterHelper
Public Class PrinterHelper
public ref class PrinterHelper
The PrinterHelper class provides properties and method to make the process of printing an image in a Leadtools.Windows.Controls.ImageBox, Leadtools.Windows.Controls.RasterImageBox, Leadtools.Windows.Controls.ImageViewer or Leadtools.Windows.Controls.RasterImageViewer controls.
PrinterHelper can be used in the following ways:
As a stand-alone printer helper class. You create an instance of PrinterHelper, set its properties and use the PrinterHelper.Print method. This method will work for WPF and Silverlight 4 and later.
The PrinterHelper.CreateCanvas method can be used to create the System.Windows.UIElement to use as the visual paramater to the WPF PrintDialog.PrintVisual when using the System.Windows.Controls.PrintDialog class.
The PrinterHelper.CreateCanvas method can also be used to create the System.Windows.UIElement to use as the Silverlight 4.0 and later PrintPageEventArgs.PageVisual property used when printing using the Silverlight 4.0 and later PrintDocument class.
The following are examples on how to print a LEADTOOLS image viewer control in Silverlight 4 or later:
// Silverlight 4 Example with printing using PrinterHelper directly
// MyImageViewer is an instance of "Leadtools.Windows.Controls.ImageViewer"
PrinterHelper helper = new PrinterHelper();
helper.Destination = new Rect(0, 0, 1, 1);
helper.IsDestinationRelative = true;
helper.Print(MyImageViewer, "My Document");
// Silverlight 4 Example with printing using PrintDocument
// MyImageViewer is an instance of "Leadtools.Windows.Controls.ImageViewer"
PrintDocument pd = new PrintDocument();
pd.PrintPage += new EventHandler<PrintPageEventArgs>(pd_PrintPage);
pd.Print("My Document");
// This is the PrintDocument PrintPage handler:
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
PrinterHelper ph = new PrinterHelper();
e.PageVisual = ph.CreateCanvas(MyImageViewer, e);
(sender as PrintDocument).PrintPage -= new EventHandler<PrintPageEventArgs>(pd_PrintPage);
}
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Printing
Private Sub PrintViewerExample(ByVal viewer As ImageViewer)
' Print the image in the viewer, fill the page and center horizontall and vertically
Dim ph As New PrinterHelper()
ph.Destination = New Rect(0, 0, 1, 1)
ph.IsDestinationRelative = True
ph.HorizontalAlignment = HorizontalAlignment.Center
ph.VerticalAlignment = VerticalAlignment.Center
ph.ImageStretch = Stretch.UniformToFill
ph.Print(viewer, "My Document")
End Sub
using Leadtools.Windows.Controls;
using Leadtools.Windows.Printing;
private void PrintViewerExample(ImageViewer viewer)
{
// Print the image in the viewer, fill the page and center horizontall and vertically
PrinterHelper ph = new PrinterHelper();
ph.Destination = new Rect(0, 0, 1, 1);
ph.IsDestinationRelative = true;
ph.HorizontalAlignment = HorizontalAlignment.Center;
ph.VerticalAlignment = VerticalAlignment.Center;
ph.ImageStretch = Stretch.UniformToFill;
ph.Print(viewer, "My Document");
}
Products |
Support |
Feedback: PrinterHelper Class - Leadtools.Windows.Controls |
Introduction |
Help Version 19.0.2017.3.22
|
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.