I want to view (only) images files and some common documents (PDF, RTF, TEXT, etc) in my Delphi program, I've found two ways of doing that,
I'm wondering, are there alternatives? Thanks.
There are two ways to go here:
I personally like to keep my source "all delphi". When it comes to displaying images Delphi is blessed with many third party libraries that provides you with support for almost every image format imaginable.
Images
ImageEN is a good package (commercial) and you might also like the free Vapyre Image Library (the name is a bit.. well, but its a great product). To quickly add support for the most common formats, GraphicsEX is a traditional Delphi extension a lot of developers use. You also have FreeImage, which is collection of DLL files - but with Delphi wrapper classes to make them easy to use. take a look in the graphics section on Torry's Delphi Pages (google it) and you will find robust support.
For PDF preview/reading I would take a look at Gnostice's product-line. They provide native Delphi components for generating and viewing PDF files (http://www.gnostice.com/). Alternatively (for PDF) I would probably go for the ActiveX components that ship with Adobe's PDF reader. But then you will have to check that these objects are registered and available to your application at startup.
So for your "universal viewer" I would
HTML
For viewing HTML you are in luck, as Delphi has it's own native Web renderer. It was written by Steve Baldwin and is called THTMLViewer. It has been released as opensource and you will find it on google projects.
Windows (since XP if I recall correctly) uses the IExtractImage
interface to generate a thumbnail for any file in thumbnails view, if it has an object listed for its file type.
These objects are accessible by code, and you can use them to generate thumbnails for any file which would get a thumbnail in Windows Explorer as well. (I even think thumbnails will be served from the thumbnail cache (Thumbs.db
) if it's available in the image size you're requesting.)
There's more here: http://yoy.be/item.asp?i1490 or here: http://msdn.microsoft.com/en-us/library/bb775073(v=vs.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With