PDF and BMP preview

Post Reply
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

PDF and BMP preview

Post by Marco Turco »

Hi,
I would like display on the same dialog a preview of a BMP image or a PDF file.

There is no problems with the image files but could be possibile to use the same IMAGE control to display also a pdf ?

This is a self-contained semplified code that I use to manage a bmp preview.

Do I have to use the PDF activex to preview a pdf file into the image control ?

Any ideas ?

Thanks in advance.



function Main()

LOCAL oDlg, oImage

DEFINE DIALOG oDlg FROM 0, 0 TO 20, 60 ;
TITLE FWDESCRIPTION + " BMP,PDF support!"

@ 0, 0 IMAGE oImage SIZE 150, 150 OF oDlg SCROLL // ADJUST

oImage:Progress( .f. )

@ 1, 28 BUTTON "Select Image" SIZE 50,10 OF oDlg ACTION GetImage( oImage )

@ 6, 28 BUTTON "Exit" SIZE 50, 10 OF oDlg ACTION oDlg:End()

@ 10, 26 CHECKBOX oImage:lStretch PROMPT "Stretch" SIZE 50, 10 OF oDlg ;
ON CHANGE ( oImage:ScrollAdjust(), oImage:Refresh() )

ACTIVATE DIALOG oDlg CENTER

return nil

//----------------------------------------------------------------------------//

function GetImage( oImage )

local gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" + ;
"PDF (*.pdf)| *.pdf|" + ;
"All Files (*.*)| *.*" ;
,"Please select a image file", 4 )

if ! Empty( gcFile ) .and. File( gcFile )
oImage:LoadBmp( gcFile )
endif

return nil
Best Regards,

Marco Turco
SOFTWARE XP LLP
Post Reply