Page 1 of 1

error to show pdf on dialog

Posted: Thu Dec 03, 2020 10:16 am
by Silvio.Falconi
Error description: Error BASE/1004 No exported method: LOADFILE
Args:
[ 1] = U
[ 2] = C Fattura_n_000246-2018_del_02-10-2018.pdf

Stack Calls
===========
Called from: => LOADFILE( 0 )
Called from: => __OBJSENDMSG( 0 )
Called from: .\source\classes\ACTIVEX.PRG => TACTIVEX:DO( 96 )
Called from: test.prg => VISUALIZZAFILEPDF( 331 )
Called from: test.prg => XMLREADER( 232 )
Called from: test.prg => IMPORTXML( 28 )
Called from: test.prg => MAIN( 11 )


Code: Select all

 DEFINE DIALOG oDlgPdfFile  SIZE nWidth, nHeight TRANSPARENT ;
   TITLE cTitle COLOR CLR_BLACK,  nRgb( 245,244,234) ;
   STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )

   oActiveX = TActiveX():New( oDlgPdfFile, "AcroPDF.PDF.1" ) 

   oDlgPdfFile:oClient = oActiveX // To fill the entire window surface

   oActiveX:Do( "LoadFile", cFile )
   oActiveX:Do( "SetCurrentPage", 1 )

    ACTIVATE DIALOG oDlgPdfFile CENTER






exist another method to show a pdf on a dialog ?

Re: error to show pdf on dialog

Posted: Sun Dec 06, 2020 6:02 pm
by nageswaragunupudi
Please try if this works for you.

Code: Select all

   local cPdfFile := "c:\fwh\samples\pdfharu1h.pdf" // your pdf file name
   local nDlgWidth   := 420
   local nDlgHeight  := 600

   if File( cPdfFile )
      HtmlView( TrueName( cPdfFile ), "TITLE", nil, nil, nil, nDlgWidth, nDlgHeight )
   else
      ? cPdfFile + " not found"
   endif
 
Image