We help IT Professionals succeed at work.

previewing images and PDFs

Shawn
Shawn used Ask the Experts™
on
I have I little database that stores the filepaths and filenames of JPGs and PDFs. I would like to be able to preview (similar to a thumbnail) the first page of the image.

How could I do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
In a form insert a web browser control.

On the current event of the form use code like this:

Me.WebBrowser.Navigate YourFieldThatStoresThePatheToThePDFOrImage


So if your field that stores the Path to the PDF/Image is called "DocPath",
Your code would be:
Me.WebBrowser.Navigate DocPath
MIS Liason
Most Valuable Expert 2012
Commented:
To avoid errors if DocPath is blank, use code similar to this:

    If Me.DocPath = "" Or IsNull(Me.DocPath) Then
        Me.WebBrowser.Visible = False
    Else
        Me.WebBrowser.Visible = True
        Me.WebBrowser.Navigate DocPath
    End If


JeffCoachman

Author

Commented:
thank you...will test and get back to you

Author

Commented:
wow, works nicely.
Is there a way to control the zoom?
.... and in the PDF file it shows the menus at top..can I hide them?
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
<Is there a way to control the zoom?>
No, not unless you want to go so far as adjusting the size of the webbrowser control itself, (and this can get messy)
So the best you can do is make the webbrowser control as big as will fit within the borders of the form.

<and in the PDF file it shows the menus at top..can I hide them?>
No, ...you can only do this if the PDF is opened independently

JeffCoachman

Author

Commented:
thanks Jeff, kinda what I thought but just checking

Author

Commented:
i just put up another question if you have a minute Q_27247608