ImagePrintDocument Class |
Namespace: Atalasoft.Imaging.WinControls
The ImagePrintDocument type exposes the following members.
Name | Description | |
---|---|---|
![]() | ImagePrintDocument() | Initializes a new instance of ImagePrintDocument. |
![]() | ImagePrintDocument(AtalaImage) | Initializes a new instance of ImagePrintDocument specifying an image to print. |
![]() | ImagePrintDocument(AtalaImage[]) | Initializes a new instance of ImagePrintDocument specifying an array of images to print on multiple
pages. |
![]() | ImagePrintDocument(ImageCollection) | Initializes a new instance of ImagePrintDocument specifying the image to print. |
![]() | ImagePrintDocument(Boolean, PrintScaleMode, AtalaImage) | Initializes a new instance of ImagePrintDocument specifying the ImageCollection to print and the center
and scalemode settings. |
![]() | ImagePrintDocument(Boolean, PrintScaleMode,AtalaImage[]) | Initializes a new instance of ImagePrintDocument specifying an array of images to print and the center
and scale mode settings. |
![]() | ImagePrintDocument(Boolean, PrintScaleMode, ImageCollection) | Initializes a new instance of ImagePrintDocument specifying the ImageCollection to print and the center
and fit to page settings. |
![]() | ImagePrintDocument(Boolean, Boolean, AtalaImage) | Obsolete. Initializes a new instance of ImagePrintDocument specifying the image to print and the center and fit to
page settings. |
![]() | ImagePrintDocument(Boolean, Boolean,AtalaImage[]) | Obsolete. Initializes a new instance of ImagePrintDocument specifying an array of images to print and the center
and fit to page settings. |
![]() | ImagePrintDocument(Boolean, Boolean, ImageCollection) | Obsolete. Initializes a new instance of ImagePrintDocument specifying the ImageCollection to print and the center
and fit to page settings. |
Name | Description | |
---|---|---|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | Center | Gets or sets a value indicating if the image is centered onto the page. |
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | DefaultPageSettings | Gets or sets page settings that are used as defaults for all pages to be printed. (Inherited from PrintDocument.) |
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | DocumentName | Gets or sets the document name to display (for example, in a print status dialog box or printer queue) while printing the document. (Inherited from PrintDocument.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | FitToPage | Obsolete. A value indicating if the image is stretched to fit the page. |
![]() | Image | Gets or sets the AtalaImage to print. |
![]() | Images | Gets or sets the images to print. |
![]() | ImageToPrint | Gets the image that will be printed for this page. |
![]() | OriginAtMargins | Gets or sets a value indicating whether the position of a graphics object associated with a page is located just inside the user-specified margins or at the top-left corner of the printable area of the page. (Inherited from PrintDocument.) |
![]() | PrintController | Gets or sets the print controller that guides the printing process. (Inherited from PrintDocument.) |
![]() | PrinterSettings | Gets or sets the printer that prints the document. (Inherited from PrintDocument.) |
![]() | ScaleMode | Gets or sets the scale mode used when printing an image. |
![]() | Site | Gets or sets the ISite of the Component. (Inherited from Component.) |
Name | Description | |
---|---|---|
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.) |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | OnAfterPrintPage | Called after the OnPrintPage(PrintPageEventArgs) method. |
![]() | OnBeginPrint | Call before printing begins. (Overrides PrintDocument.OnBeginPrint(PrintEventArgs).) |
![]() | OnEndPrint | Raises the EndPrint event. It is called when the last page of the document has printed. (Inherited from PrintDocument.) |
![]() | OnGetImage | Raises the GetImage event to obtain the image to print. |
![]() | OnPrintImage | Called to send the image to the printer and raises the PrintImage event.
|
![]() | OnPrintPage | Called for each page being printed. (Overrides PrintDocument.OnPrintPage(PrintPageEventArgs).) |
![]() | OnQueryPageSettings | Raises the QueryPageSettings event. It is called immediately before each PrintPage event. (Inherited from PrintDocument.) |
![]() | Starts the document's printing process. (Inherited from PrintDocument.) | |
![]() | SetImagesFromImageCollection | |
![]() | ToString | Provides information about the print document, in string form. (Inherited from PrintDocument.) |
Name | Description | |
---|---|---|
![]() | AfterPrintPage | Occurs after image is prepared to print. |
![]() | BeginPrint | Occurs when the Print() method is called and before the first page of the document prints. (Inherited from PrintDocument.) |
![]() | Disposed | Occurs when the component is disposed by a call to the Dispose() method. (Inherited from Component.) |
![]() | EndPrint | Occurs when the last page of the document has printed. (Inherited from PrintDocument.) |
![]() ![]() | GetImage | Occurs when the print job requires the next image to print. |
![]() | PrintImage | Occurs just before the image is printed. |
![]() | PrintPage | Occurs when the output to print for the current page is needed. (Inherited from PrintDocument.) |
![]() | QueryPageSettings | Occurs immediately before each PrintPage event. (Inherited from PrintDocument.) |
The .NET Framework contains the PrintDialog, PrintPreviewDialog, PrintPreviewControl, and PageSetupDialog giving you fine control over printer settings and showing a preview of the output. Each of these uses a PrintDocument. The ImagePrintDocument extends the PrintDocument so that you can take advantage of this functionality when printing images in DotImage.
Multiple images can be printed by setting the Images array property, or by handling the GetImage event and setting the HasMorePages property of the PrintPageEventArgs to true.
This example requires you have a placed an ImagePrintDocument onto your form. It demonstrates printing one image to the printer, and scaling it to fit the page.
myImagePrintDocument.Image = myImageViewer.Image; myImagePrintDocument.ScaleMode = PrintScaleMode.FitToMargins; myImagePrintDocument.Print();
myImagePrintDocument.Image = myImageViewer.Image myImagePrintDocument.ScaleMode = PrintScaleMode.FitToMargins myImagePrintDocument.Print()
This example demonstrates how to print all images in a WorkspaceViewer to the printer while letting the user specify page and printer settings. By handling the PrintPage and AfterPrintPage events, it also demonstrates how to customize individual pages that are printed. This example uses a WorkspaceViewer, ImagePrintDocument, PageSetupDialog, and PrintDialog in a WinForms application. The Document Property in the PageSetupDialog and PrintDialog must be set to the ImagePrintDocument.
private void imagePrintDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //allows the user to customize page fitting for each page that's printed if (MessageBox.Show(this, "Do you wish to fit this image to the page?", "Specify Page Fitting", MessageBoxButtons.YesNo) == DialogResult.Yes) imagePrintDocument1.ScaleMode = PrintScaleMode.FitToMargins; else imagePrintDocument1.ScaleMode = PrintScaleMode.None; } private void imagePrintDocument1_AfterPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //draws a watermark on the page e.Graphics.DrawString("This is a test watermark.", new Font("Arial", 18), new SolidBrush(Color.Black), 0, 0); } private void btnPrintImage_Click(object sender, System.EventArgs e) { //lets the user set the printer options if (printDialog1.ShowDialog(this) == DialogResult.OK) { //set all images from the image collection imagePrintDocument1.SetImagesFromImageCollection(workspaceViewer1.Images); imagePrintDocument1.Print(); } } private void btnPageSetup_Click(object sender, System.EventArgs e) { //lets the user modify the page settings such as margins pageSetupDialog1.ShowDialog(this); }
Private Sub imagePrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles imagePrintDocument1.PrintPage 'allows the user to customize page fitting for each page that's printed If MessageBox.Show(this,"Do you wish to fit this image to the page?","Specify Page Fitting",MessageBoxButtons.YesNo) = DialogResult.Yes Then imagePrintDocument1.ScaleMode = PrintScaleMode.FitToMargins Else imagePrintDocument1.ScaleMode = PrintScaleMode.None End If End Sub Private Sub imagePrintDocument1_AfterPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles imagePrintDocument1.AfterPrintPage 'draws a watermark on the page e.Graphics.DrawString("This is a test watermark.", New Font("Arial", 18), New SolidBrush(Color.Black), 0, 0) End Sub Private Sub btnPrintImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintImage.Click 'lets the user set the printer options If printDialog1.ShowDialog(Me) = DialogResult.OK Then 'set all images from the image collection imagePrintDocument1.SetImagesFromImageCollection(workspaceViewer1.Images) imagePrintDocument1.Print() End If End Sub Private Sub btnPageSetup_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPageSetup.Click 'lets the user modify the page settings such as margins pageSetupDialog1.ShowDialog(Me) End Sub