Skip to main content

dxPDFViewerOpenDocumentDialog(string) Method

Invokes the Open dialog allowing you to select a PDF document file for loading.

Declaration

function dxPDFViewerOpenDocumentDialog(var AFileName: string): Boolean;

Parameters

Name Type Description
AFileName string

The full path to a PDF document.

Returns

Type Description
Boolean

The function returns True if the function returns a non-empty path; otherwise - False.

Remarks

You can use this global function together with the PDF Viewer’s LoadFromFile procedure to implement an alternative to the OpenDocument command. The dxPDFViewerOpenDocumentDialog function returns False if an end-user clicks the “Cancel” button in the Open dialog; otherwise, True. The path to a file selected by an end-user is returned as the AFileName parameter.

An example of using the dxPDFViewerOpenDocumentDialog function is listed below:

var
  AFileName: string;
//...
  if(dxPDFViewerOpenDocumentDialog(AFileName)) then  // If the file path is not an empty string
    dxPDFViewer1.LoadFromFile(AFileName);  // Load the specified PDF document
See Also