Class PrintManager
Provides the base implementation for printing related operations in all controls.
Implements
Namespace: Syncfusion.Windows.Shared.Printing
Assembly: Syncfusion.Shared.WPF.dll
Syntax
public class PrintManager : Object, INotifyPropertyChanged, IDisposable
Constructors
PrintManager(PrintSettingsBase)
Initializes a new instance of PrintManager class.
Declaration
public PrintManager(PrintSettingsBase settings)
Parameters
Type | Name | Description |
---|---|---|
PrintSettingsBase | settings |
Fields
isPagesInitialized
Used to avoid the properties intialization more than one time.
Declaration
protected bool isPagesInitialized
Field Value
Type |
---|
System.Boolean |
isSuspended
Declaration
protected bool isSuspended
Field Value
Type |
---|
System.Boolean |
SelectedPageMediaName
Declaration
protected string SelectedPageMediaName
Field Value
Type |
---|
System.String |
Properties
Collation
Gets or sets the value to Specifies whether a printer collates output when it prints multiple copies of a multi-page print job.
Declaration
public Collation Collation { get; }
Property Value
Type |
---|
System.Printing.Collation |
CopiesCount
Gets or sets the CopiesCount of the printing element.
Declaration
public int CopiesCount { get; }
Property Value
Type |
---|
System.Int32 |
FromPage
Gets or sets the FromPage of the printing element.
Declaration
public int FromPage { get; }
Property Value
Type |
---|
System.Int32 |
PageCount
Gets or sets the value to the page count.
Declaration
public int PageCount { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 | The total pages count that are created for printing.And the default value is 0; |
PageFooterHeight
Gets or sets the height of the page footer for printing.
Declaration
public double PageFooterHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The height of the page footer.And the default value of the PageFooterHeight is 0.0; |
PageFooterTemplate
Gets or sets System.Windows.DataTemplate that defines the visual representation of the page footer for printing.
Declaration
public DataTemplate PageFooterTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | The object that defines the visual representation of the page footer. The default is null. |
PageHeaderHeight
Gets or sets the height of the page header for printing.
Declaration
public double PageHeaderHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The height of the page header.And the default value of the PageHeaderHeight is 0.0; |
PageHeaderTemplate
Gets or sets System.Windows.DataTemplate that defines the visual representation of the page header for printing.
Declaration
public DataTemplate PageHeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | The object that defines the visual representation of the page header. The default is null. |
PageHeight
Gets or sets the height of a page for printing.
Declaration
public double PageHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The height of a page for printing.And the default value of the PageHeight is 1122.52; |
PageMargin
Gets or sets the System.Windows.Thickness margin of page for printing.
Declaration
public Thickness PageMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Thickness | Provides the margin value for the page.The default value of the margin is 94.49. |
PageOrientation
Gets or sets a value indicating how the page content is oriented for printing.
Declaration
public PrintOrientation PageOrientation { get; set; }
Property Value
Type | Description |
---|---|
PrintOrientation | One of the PrintOrientation enumeration that specifies how the page content is oriented. The default orientation is Portrait. |
PageRangeSelection
Gets or sets the value to Specifies whether all the pages or only a limited range will be processed by an operation, usually printing.
Declaration
public PageRangeSelection PageRangeSelection { get; }
Property Value
Type |
---|
System.Windows.Controls.PageRangeSelection |
Pages
Declaration
protected List<PrintPageControl> Pages { get; }
Property Value
Type |
---|
System.Collections.Generic.List<PrintPageControl> |
PageSizeDisplayUnit
Gets or sets the LenthUnit to the page Size.
Declaration
public PageSizeUnit PageSizeDisplayUnit { get; set; }
Property Value
Type |
---|
PageSizeUnit |
PageSizeOptions
Gets PageSizes supported by active printer.
Declaration
public List<PrintPageSize> PageSizeOptions { get; }
Property Value
Type |
---|
System.Collections.Generic.List<PrintPageSize> |
PageWidth
Gets or sets the width of a page for printing.
Declaration
public double PageWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of a page for printing.And the default value of the PageWidth is 793.70; |
Printers
Declaration
public List<PrintQueueOption> Printers { get; }
Property Value
Type |
---|
System.Collections.Generic.List<PrintQueueOption> |
PrintSettings
Declaration
protected PrintSettingsBase PrintSettings { get; }
Property Value
Type |
---|
PrintSettingsBase |
SelectedPrinter
Gets currenlty active printer.
Declaration
public PrintQueueOption SelectedPrinter { get; }
Property Value
Type |
---|
PrintQueueOption |
SelectedScaleIndex
Gets or sets the selected index of scaling options selected Item.
Declaration
public int SelectedScaleIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the scaling options selected Item.The default value is 0. |
ToPage
Gets or sets the ToPage of the printing element.
Declaration
public int ToPage { get; }
Property Value
Type |
---|
System.Int32 |
Methods
ComputePageCount()
Used to compute the pages which is present in the print preview.
Declaration
protected virtual void ComputePageCount()
CreatePage(Int32)
Creates the page for the specified page index and arrange the page content with in that page.
Declaration
protected virtual PrintPageControl CreatePage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The corresponding page index to create page. |
Returns
Type | Description |
---|---|
PrintPageControl | Returns the new |
CreatePage(Int32, PrintPageControl)
Creates the page corresponding to the specified page index and page control.
Declaration
protected virtual PrintPageControl CreatePage(int pageIndex, PrintPageControl pageControl)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The corresponding page index to create page. |
PrintPageControl | pageControl | PrintPageControl The corresponding page control to create page. |
Returns
Type |
---|
PrintPageControl |
Dispose()
Releases all the resources used by the PrintManager class.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes all the resources used by the
Declaration
protected virtual void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. |
GetPrintDocument()
Gets the print document of page control.
Declaration
public virtual FixedDocument GetPrintDocument()
Returns
Type | Description |
---|---|
System.Windows.Documents.FixedDocument | Returns the System.Windows.Documents.FixedDocument that contains the print document of page control. |
GetPrintDocument(Int32, Int32)
Gets the print document of page control based on the specified start and end index of page.
Declaration
public virtual FixedDocument GetPrintDocument(int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | start | The start index of the page to get print document. |
System.Int32 | end | The end index of the page to get print document. |
Returns
Type | Description |
---|---|
System.Windows.Documents.FixedDocument | Returns the System.Windows.Documents.FixedDocument for the specified start and end index of the page contains the print document of page control. |
GetScaleOptions(String)
Used to update the ScaleOptions to the, that contains the information about
Declaration
protected virtual List<PrintScaleInfo> GetScaleOptions(string themeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | themeName |
Returns
Type |
---|
System.Collections.Generic.List<PrintScaleInfo> |
InitializeProperties()
Initializes properties and settings for printing process.
Declaration
protected virtual void InitializeProperties()
OnPageSizeChanged(Double, Double)
Update the print manager based upon the paper option changed from the print option control.
Declaration
protected virtual void OnPageSizeChanged(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | width of the page. |
System.Double | height | height of the page. |
OnPrintMarginChanged(Thickness)
Update the print manager based upon the margin option changed from the print option control.
Declaration
protected virtual void OnPrintMarginChanged(Thickness value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Thickness | value | Margin thickness of the page. |
OnPrintOrientationChanged(PrintOrientation)
Update the print manager based upon the paper option changed from the print option control.
Declaration
protected virtual void OnPrintOrientationChanged(PrintOrientation value)
Parameters
Type | Name | Description |
---|---|---|
PrintOrientation | value | Print orientation of the page. |
OnPrintPropertyChanged()
Used to invalidate the preview panel when print properties are changed.
Declaration
protected void OnPrintPropertyChanged()
OnPrintScaleOptionChanged(Int32)
Update the print manager based upon the page scale option changed from the print option control.
Declaration
protected virtual void OnPrintScaleOptionChanged(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
OnPropertyChanged(String)
Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The Dependency Property Name. |
OnSelectedPrinterChanged(PrintQueue)
Used to add the custom size’s for the specific printer which we chosen.
Declaration
public virtual void OnSelectedPrinterChanged(PrintQueue printQueue)
Parameters
Type | Name | Description |
---|---|---|
System.Printing.PrintQueue | printQueue | Manages printers and print jobs. |
Print()
Prints the content of page control.
Declaration
public void Print()
Print(PrintDialog, Boolean)
Prints the content of page control according to the print ticket and print queue configurations in the print dialog.
Declaration
public virtual void Print(PrintDialog printDialog, bool showPrintDialog)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.PrintDialog | printDialog | Configures the PrintTicket and PrintQueue according to the user input for printing. |
System.Boolean | showPrintDialog |
PrintDocument(PrintDialog, Nullable<Boolean>)
Prints the content of page control according to the print ticket and print queue configures in the print dialog.
Declaration
protected virtual void PrintDocument(PrintDialog printDialog, Nullable<bool> canPrint)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.PrintDialog | printDialog | Configures the PrintTicket and PrintQueue according to the user input for printing. |
System.Nullable<System.Boolean> | canPrint | Decides whether the print can be performed or not. |
Events
PropertyChanged
Occurs when a property value changes in PrintManager class.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
---|
System.ComponentModel.PropertyChangedEventHandler |