Hi,

Currently I don't have any code for this but request you help on this.

In the form1 I have Picuter box. I want to view Images (All types of Formats) & PDF files as regular images in Picture box. Is this is possible.

Also I need Shortcut keys to be created for browsing images.

---------

F9 = Previous Image / Page
F10 = Next Image / Page
F11 = First Image / Page of the Folder or PDF file
F12 = Last Image / Page of the Folder or PDF file
Ctrl + i = Zoomin
Ctrl + o = Zoomout

Waiting for your positive response. Thanks for your valuable time & suggestions.

I was looking for the same solution and ended up buying a viewer. But simply, you can easily convert PDFs to tifs as part of your function, then view the tif on the fly. You need to be able to make sure you can view multi paged tifs from your picture box which is possible, but has to be set up to do that. You'll have to search for code for that, I've seen it out there. Image Magick is a free program for which you can write .bat files which will easily and quickly convert PDFs silently as one part of your function. You'll need to write an open file function that does PDFs only. Once viewed, you can destroy or do whatever you want with the tifs.

Edited 2 Years Ago by tareywolf

The other way to do it is instead of using a picturebox you could use a webbrowser control which will also display images as well as PDFs. You can shut off the "link following" capability etc. so it will act more as just a display unit.

If your requirement with PDF is simple like just loading it as an image, there are great free sdks like iTextSharp that can do the job. However, if you want advanced PDF and imaging features, you might need to go commercial because from my experience, commercial libraries are better maintained. I’d recommend using an sdk called leadtools that provides advanced PDF features as well as support for many other raster formats.
This depends on your requirement.

As for making implementing keyboard, one way to do this is by implementing KeyDown event and using a switch statement to see which key is pressed and do what you want.

For Next, Previous or any other Shortcut key.
You can code this under Keydown Property.

if e.keycode = Keys.O then
   button1_click(sender,e)
End if   

and sorry, I am also searching How to zoom in and out.
For this I got one code project article but it zooming the Picturebox not image... So Sorry for Half Information....

Download source file which show how to browse image and pDF to open in VB Program. DOWNLOAD HERE

This article has been dead for over six months. Start a new discussion instead.