Using A Different Format from HTML

Using A Different Format from HTML

You can avoid using HTML altogether by using a different format from HTML, such as Portable Document Format (PDF) or an image.

Portable Document Format

Portable Document Format (PDF), often called the Acrobat format after the program most commonly used to display it, is a format for storing formatted documents in a device-independent manner. Created by Adobe Systems, it inherits much from PostScript, which is another page-description language by Adobe.

PDF is like "digital paper." It can store one or more pages of text and images, ready to be printed or viewed onscreen. Compared to image formats such as PNG, GIF, and JPEG, it has a number of advantages. First, it can contain actual text, not just images of text (bitmaps). As a result, it can scale the pages and print at any resolution: The text looks as good as the printer allows. Second, it can replace fonts by generated approximations (multiple master fonts) in case the document uses uncommon fonts and the document's creator didn't embed the font, either for copyright reasons or just to save space. Third, because the text in the document is stored as text and not as bitmaps, you can search the document for keywords. Fourth, PDF can even contain hyperlinks, not only within the document but also as URLs that point to documents on the Web.

The disadvantage is that the text is already formatted as you get it. Resizing the window won't change the number of words per line, as it normally does in HTML. The structure of the text is also lost: You cannot save the document and edit it. Even if you manage to save the text and load it into some other program, no tags tell you that a certain piece of text is a heading or a list item. Because spaces are often not stored explicitly, and letters don't necessarily appear in the file in the order they appear onscreen, the PDF software has to use heuristics to even recognize words.

PDF is a good solution for old documents that cannot be converted to HTML or would need a lot of work to allow conversion. Usually, when you can print a document, you can also convert it to PDF. Many documents created with old word processors were never meant for use on the Web and printing them is pretty much the only thing you can do with them.


You can also use images that are stored in PNG, GIF, or JPEG format. We briefly discussed using images in place of text in Chapter 1, "The Web and HTML." A Web page consisting of just an image gives the page's designer control over every pixel, especially when the PNG format is used. PNG is the most accurate when it comes to defining the color of pixels. But, that level of control comes at a price.

First, robots cannot read the page. Second, the page is much larger in terms of bytes than a page that consists of text with a style sheet and thus takes longer to download.

Third, the page has a fixed size. As a result, users may have trouble reading the image for several reasons. On large screens, the image may be too small. On small screens, the image may be too large. On monochrome screens, too many colors may be shown as almost the same shade of gray. On text-only browsers, users won't see anything.

Fourth, printing the page also gives less than satisfactory results. Not all printers can print in color. The result may either be small or look grainy (see Figure).

1. Normal text (a) and an image (b). On the screen, the two look the same, but on paper, the text was printed with all the quality the printer could offer, while the image was just copied pixel for pixel.

Fifth, as with any format that doesn't rely on style sheets for the layout, it will not be readable by someone who is blind (images can be converted neither to speech nor to Braille) and will be difficult to read for someone with limited eyesight. (Although the images can be enlarged, it is difficult to change the colors as you can with text.)

Finally, when you want to modify the document, it is more difficult to change an image than a text or a style sheet.

For these reasons, it is advisable to use images only for effects that cannot be achieved with a style sheet. And then, only if the look is so important that it outweighs the disadvantages. Of course, you should also include the text in the alt attribute of the IMG element for people who cannot see the image.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows