There are two ways:
- Use any software provided by Windows
- Stick to Delphi's built-in components.
I personally like to keep my source "all delphi". When it comes to displaying images, Delphi is blessed with many third-party libraries that provide you with support for almost any image format you can imagine.
Images
ImageEN is a good (commercial) package and you might also like the free Vapyre image library (the name is a little ... well, but it's a great product). To quickly add support for the most common formats, GraphicsEX is a traditional Delphi extension that is used by many developers. You also have FreeImage, which is a collection of DLL files, but with Delphi shell classes to make them easy to use. look in the graphic section on the pages of Torry Delphi (google it) and you will find reliable support.
Pdf
For viewing and reading PDF, I would look at the Gnostice product line. They provide Delphi's own components for creating and viewing PDF files (http://www.gnostice.com/). As an alternative (for PDF), I would probably go for the ActiveX components that come with the Adobe PDF reader. But then you have to check that these objects are registered and available for your application at startup.
So, for your "universal viewer" I would
- Create a basic form for viewing (to provide buttons, status bar, etc.).
- Add a virtual method to open a file
- Cancel 3 forms from this so that each transaction has a different type of media. This way you get TfrmPDF, TfrmImage and TfrmHTML. In each case, override the open () method. Thus, your main application does not have to worry about the details of each format.
HTML
You are lucky to view HTML, as Delphi has its own web rendering of its own. It was written by Steve Baldwin and is called THTMLViewer. It was released as open source and you will find it on google projects.
source share