WPViewPDF in MDI Style application

    • Offizieller Beitrag

    If you have a WPViewPDF control on a child unit the recommended way is to load the WPViewPDF engine from the main form, i.e. with this code:

    Code
    {$I PDFLicense.INC}// please add "WPViewPDF3" to uses clauseprocedure TViewMain.FormCreate(Sender: TObject);var viewerdll : String;begin  {$IFDEF WIN64}  viewerdll := ExtractFilePath( Application.ExeName ) + WPViewPDF_DLLName64;  {$ELSE}  viewerdll := ExtractFilePath( Application.ExeName ) + WPViewPDF_DLLName;  {$ENDIF}  if not WPViewPDFLoadDLL( viewerdll, true) then  begin    ShowMessage('PDF Viewing is not available');    SelectPDFFile.Enabled := false;  end;end;

    The childform with the viewer can then be created with a few lines of code:

    Note: Assigning a different name to WPViewPDF1.DLLName can be problematic, if the DLL was already loaded automatically.