VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Wpf.Print Namespace / WpfImagePrintManager Class
Members Example



In This Topic
    WpfImagePrintManager Class
    In This Topic
    Provides functionality for printing an Vintasoft.Imaging.ImageCollection. Also class allows to use the Vintasoft.Imaging.Wpf.UI.WpfThumbnailViewer for print preview.
    Object Model
    WpfImagePrintManager ClassResolution StructureImageCollection ClassVintasoftImage ClassWpfThumbnailViewer ClassColorManagementDecodeSettings ClassColorManagementDecodeSettings ClassResolution StructureProcessingCommandBase Class
    Syntax
    'Declaration
     
    Public Class WpfImagePrintManager 
    public class WpfImagePrintManager 
    public __gc class WpfImagePrintManager 
    public ref class WpfImagePrintManager 
    Example
    This example shows how to print a image collection on a default printer, each image of the image collection will be printed in BestFit mode:
    ''' <summary>
    ''' Prints images on default printer.
    ''' </summary>
    ''' <param name="images">The images, which must be printed.</param>
    Public Sub PrintImagesOnDefaultPrinter(images As Vintasoft.Imaging.ImageCollection)
        ' create print manager
        Dim imagePrintManager As New Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager()
        ' specify image collection which should be printed
        imagePrintManager.Images = images
        ' specify that each image must be resized to fit within the page margins,
        ' image proportions is not changed
        imagePrintManager.PrintScaleMode = Vintasoft.Imaging.Print.PrintScaleMode.BestFit
                
        ' subscribe to the PrintingProgress event
        AddHandler imagePrintManager.PrintingProgress, New System.EventHandler(Of Vintasoft.Imaging.ProgressEventArgs)(AddressOf imagePrintManager_PrintingProgress)
                
        ' start the printing process
        imagePrintManager.Print("Print task title")
    End Sub
                
    ''' <summary>
    ''' Image printing is in progress.
    ''' </summary>
    Private Sub imagePrintManager_PrintingProgress(sender As Object, e As Vintasoft.Imaging.ProgressEventArgs)
        ' if printing is started
        If e.Progress = 0 Then
            System.Console.Write("Printing: ")
        End If
                
        ' write the printing progress
        System.Console.Write(String.Format("{0} ", e.Progress))
                
        ' if printing is finished
        If e.Progress = 100 Then
            Dim imagePrintManager As Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager = DirectCast(sender, Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager)
            ' unsubscribe from the PrintingProgress event
            RemoveHandler imagePrintManager.PrintingProgress, New System.EventHandler(Of Vintasoft.Imaging.ProgressEventArgs)(AddressOf imagePrintManager_PrintingProgress)
        End If
    End Sub
    /// <summary>
    /// Prints images on default printer.
    /// </summary>
    /// <param name="images">The images, which must be printed.</param>
    public void PrintImagesOnDefaultPrinter(Vintasoft.Imaging.ImageCollection images)
    {
        // create print manager
        Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager imagePrintManager =
            new Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager();
        // specify image collection which should be printed
        imagePrintManager.Images = images;
        // specify that each image must be resized to fit within the page margins,
        // image proportions is not changed
        imagePrintManager.PrintScaleMode = Vintasoft.Imaging.Print.PrintScaleMode.BestFit;
                
        // subscribe to the PrintingProgress event
        imagePrintManager.PrintingProgress +=
            new System.EventHandler<Vintasoft.Imaging.ProgressEventArgs>(imagePrintManager_PrintingProgress);
                
        // start the printing process
        imagePrintManager.Print("Print task title");
    }
                
    /// <summary>
    /// Image printing is in progress.
    /// </summary>
    private void imagePrintManager_PrintingProgress(object sender, Vintasoft.Imaging.ProgressEventArgs e)
    {
        // if printing is started
        if (e.Progress == 0)
            System.Console.Write("Printing: ");
                
        // write the printing progress
        System.Console.Write(string.Format("{0} ", e.Progress));
                
        // if printing is finished
        if (e.Progress == 100)
        {
            Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager imagePrintManager =
                (Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager)sender;
            // unsubscribe from the PrintingProgress event
            imagePrintManager.PrintingProgress -=
                new System.EventHandler<Vintasoft.Imaging.ProgressEventArgs>(imagePrintManager_PrintingProgress);
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Wpf.Print.WpfImagePrintManager
          Vintasoft.Imaging.Annotation.Wpf.Print.WpfAnnotatedImagePrintManager

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also