Accusoft.PrintPro8.Net
Print Preview

PrintPRO™ lets you create a print preview image for any document page.  

1. Decide whether to Display Print Preview while Printing Document

If you plan on creating print preview images while printing a document, you need to start a print document using the CreateFilePrinter Method before initiating a print preview. 

2. Initiate Print Preview

To initiate a print preview, you must call the PrintPreviewJob Method. After initiating a print preview, continue to create a print job. Use the Finish Method to end the print preview. If you are creating a multiple page document, PrintPRO will automatically create a print preview for each page. 

3. View a Print Preview Page

When you want to view a print preview for a page, you first need to determine the size of the print preview image using the PrintPreviewScale Property. Next, use one of the GetPrintPreview Methods to create a bitmap, DIB or image for the page you want to view. Finally, use the PrintBitmap, PrintDib, or PrintImage methods to export the print preview image. 

4. Resource Cleanup

Print preview requires system resources that PrintPRO automatically takes care of. You can, however, delete the print preview resources yourself. The Finish method releases the print preview image. You can always recreate the bitmap using the GetPrintPreview Methods, so deleting the image when it is no longer needed will conserve system resources.

The Dispose Method deletes the print preview resources for a page. If you delete the print preview resources, you cannot recreate the bitmap image for that page. 

The following code creates a simple print preview of a single line of text. An ImagXpress® control is used to display the image.

Example
Copy Code
/* prompt the user for the desired printer */
printer = Accusoft.PrintProSdk.Printer.SelectPrinter(pp,true);

/* create a print preview job for the above-specified printer */
job = new Accusoft.PrintProSdk.PrintPreviewJob(printer);

/* draw text */
job.Draw.Text("Print Preview Page 1");

/* Finish the print job to the end of the current page and "print" the document */
job.Finish();

/* display the generated preview image by getting a .NET Bitmap from the PrintPreviewJob
and converting it into an ImagXpress ImageX object. */
ixvPreview.Image = Accusoft.ImagXpressSdk.ImageX.FromBitmap(ix,job.GetPrintPreviewBitmap(1));

 

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback