ImageEn, unit iexUserInteractions

TIEPdfViewerInteraction.Print

TIEPdfViewerInteraction.Print


Declaration

function Print(ShowPrintDialog: Boolean; const TaskName: string = ''): Boolean; overload;
function Print(Page: Integer; ShowPrintDialog: Boolean; const TaskName: string = ''): Boolean; overload;
function Print(FromPage, ToPage: Integer; ShowPrintDialog: Boolean; PrintRange: TPrintRange = prPageNums; TaskName: string = ''): Boolean; overload;


Description

Print a PDF document at highest quality.

Commence a search for text in the current page.
Parameter Description
ShowPrintDialog If true, a standard pritn dialog is displayed allowing the user to choose a printer, select print range, etc. If False, the pages are printed to the current printer
FromPage, ToPage Optionally specify which pages to print (ZERO-based values). If either value is -1 it defaults to the first/last page
PrintRange Speciy the default selection in the Print Dialog. Either prAllPages to default to printing all pages, or prPageNums to default to the specified pages
TaskName Specify the name displayed for the task in the printer status dialog (if not specified, it defaults to the application name)

Result is True if printing occurs.

Notes:
- Configure advanced printing options using PrintOptions
- When printing, OnProgress will report what percentage of pages have been printed. OnFinishWork will occur after printing completes
- Other events that also occur while printing: OnPrintPage and OnUserInteraction (ieiPdfPrintPage, ieiPdfPrintEnd)


Demo

Demo  Demos\Other\PdfViewer\PdfViewer.dpr
Demo  Demos\Other\PdfPrinter\PdfPrinter.dpr


Example

// Prompt user to the print the current document
ImageEnView1.PdfViewer.Print( True );

// Print the current document without confirming
ImageEnView1.PdfViewer.Print( False );

// Print page 1 to page 10
ImageEnView1.PdfViewer.Print( 0, 9, False );

// Print page 10 to end of document
ImageEnView1.PdfViewer.Print( 9, -1, False );

// Print just the current page
ImageEnView1.PdfViewer.Print( ImageEnView1.PdfViewer.PageIndex, False );

// Prompt the user to print the current page, but allow them to change selection to all document
ImageEnView1.PdfViewer.Print( ImageEnView1.PdfViewer.PageIndex, ImageEnView1.PdfViewer.PageIndex, True, prPageNums );

// Print a PDF file non-visually
var
  ieview: TImageEnView;
begin
  ieview := TImageEnView.Create( nil );
  ieview.PdfViewer.Enabled := True;
  ieview.IO.LoadFromFilePDF( 'D:\File.pdf' );
  ieview.PdfViewer.Print( False );
  ieview.Free();
end;


See Also

- CanFindNext
- FindNext
- FindDialog
- ClearSelection