ImageEn, unit imageenio

TImageEnIO.LoadFromFilePDF

TImageEnIO.LoadFromFilePDF


Declaration

function LoadFromFilePDF(const FileName: string; Width: Integer = -1; Height: Integer = -1; const Password: string = ''): Boolean;


Description

Loads a PDF image PDF into the attached TImageEnView or TIEBitmap using a plug-in.
You can optionally specify a size to load the PDF file to improve quality (the size will be automatically adjusted to maintain the aspect ratio). If the file is encrypted you will need to specify the password.
Result will be false if the file is not PDF format or no PDF plug-ins are available (Aborting will be true). Loading errors due to a file not being available will raise an exception.

PDF loading requires one of the following plug-ins:
- ImageEn PDFium Plug-in
- WPViewPDF commercial plug-in
- ImageMagick + GhostScript

Notes:
- PDF loading creates a rasterized image of each page (unless PdfViewer = True)
- To manipulate PDF files, enable PdfViewer
- Use ImageIndex to specify which page of the PDF file to load
- Read more about ImageEn PDF Support


Examples

// Load the 3rd page of a PDF file with max dimensions of 1000x1000
ImageEnView1.ImageIndex := 2;
ImageEnView1.IO.LoadFromFilePDF( 'C:\Test.pdf', 1000, 1000 );

// Display a PDF document
ImageEnView1.PdfViewer.Enabled := True;
ImageEnView1.IO.LoadFromFilePDF( 'C:\document.pdf' );

// Merge two PDF documents
ImageEnView1.PdfViewer.Enabled := True;
ImageEnView1.IO.LoadFromFilePDF( 'C:\document.pdf' );
ImageEnView1.PdfViewer.ImportPages( 'C:\morepages.pdf' );
ImageEnView1.IO.SaveToFilePDF( 'C:\merged.pdf' );

// When rendering PDF files scale to double size
// Note: This assumes ImageEnView1.PdfViewer.Enabled = False, because the PdfViewer always outputs at full resolution of the display
IEGlobalSettings().PdfViewerDefaults.DPI := 144; // PDF files are 72 DPI, so 144 is 200% size
ImageEnView1.IO.LoadFromFilePDF( 'C:\Test.pdf' );


See Also

- PdfViewer
- PdfViewerDefaults