ImageEn, unit iexUserInteractions

TIEPdfViewer.Print

TIEPdfViewer.Print


Declaration

function Print(ShowPrintDialog: Boolean = False; const TaskName: string = ''; AutoOrient: Boolean = False): Boolean; overload;
function Print(Page: Integer; ShowPrintDialog: Boolean = False; const TaskName: string = ''; AutoOrient: Boolean = False): Boolean; overload;
function Print(FromPage, ToPage: Integer; ShowPrintDialog: Boolean = False; PrintRange: TPrintRange = prPageNums; TaskName: string = ''; AutoOrient: Boolean = False): Boolean; overload;
function Print(Pages: array of integer; const TaskName: string = ''; AutoOrient: Boolean = False): 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 print 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 Specify 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)
AutoOrient When enabled, will automatically set the printing to landscape or portrait to best match the page

Result is True if printing occurs.

Note:
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)


Demos

Demo  Demos\PDF\PDFViewer\PdfViewer.dpr
Demo  Demos\PDF\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