PDF In-Depth

PDF Best Practices #7: Graphics

June 03, 2003

Advertisement
Advertisement
 

Editor's Note: Like the others in this series to date, the following article does not specifically discuss the recently released Acrobat 6; Shlomo will be reviewing his previous 'Best Practices' articles and, where necessary, will provide an Acrobat 6-oriented update in the not-too-distant future.

Any discussion of graphics in PDFs is inherently closely related to the specific content, intended uses of the PDF file and the function of the graphics within the file. Factors such as graphic format, image resolution, and color depth all depend on the specific use of the PDF. And because of the many issues involved, there are invariably trade-offs and compromises to be made.

This column focuses on graphics in PDFs used as online documents (on-screen display), and where relevant, general-purpose (office) printing (a separate column will focus on accessibility aspects).

Note: Previous PDF Best Practices articles had a separate section analyzing the issues discussed, as implemented in the PDFs included in the Acrobat 5 CD. In this article, examples from the Acrobat 5 PDFs are interspersed in the article where applicable, indicated by [Acrobat 5 CD].

The manner in which graphics are displayed in a PDF depends on a number of factors, including the source graphics, its graphic format (vector/bitmap), the bitmap resolution as indicated in the authoring application, the distilling job options and the viewing preferences.

Graphic Formats

Graphics are stored as a computer file in two distinct ways: bitmap and vector.

Bitmap graphics are a collection of dots called pixels (picture elements), arranged in a matrix, each pixel with a different color value. Bitmaps are the native format of photographs, scanned images and screen captures. The number of pixels in a given area is known as resolution, commonly expressed as dpi (dots per inch) or ppi (pixels per inch).

Bitmaps are resolution-dependent, which means that for optimal display in Acrobat, there must be a match between the pixel matrix stored in the graphics and the display pixel matrix. When a given bitmap is displayed using a different number of pixels, let's say a 100 by 100 pixel bitmap is displayed in an area of 160 by 160 pixels, or in an area of 90 by 90 pixels, some pixels are added or eliminated. This process is known as "resampling", and results in degradation of image quality. Rotating bitmaps using angles other than 90 degrees also causes images to be distorted.

Common bitmap formats include BMP, GIF, TIFF, JPEG, PNG.

Vector graphics are a list of drawing objects (such as lines, arcs, curves, circles, and rectangles), encoded as textual or binary instructions.

Vector graphics work best when real-life photographs are not necessary. In fact, they can often be clearer in detail than a photograph, enabling you to emphasize the important details and eliminate or minimize details that cause visual noise. However, when vector graphics try to imitate a photograph, the look can be "synthetic" or "technical".

Vector graphics can also pose some difficulties when displayed in Acrobat:

  • Thin lines may be displayed with inconsistent line thickness.

  • Complex multi-component drawings may challenge Acrobat's drawing functions, resulting in a painfully slow painting process that involves many thousands of segments. As the rendering result is not cached by Acrobat, the slower display is experienced every time you zoom in/out or go the next page and back.

  • When you have layers or gradations implemented as multiple objects, Acrobat's display process shows different objects temporarily displayed and then covered partially - which may sidetrack the reader's attention.

As vector graphics is independent of display/output resolution, it can be scaled or rotated flexibly. It will always display/print at the highest resolution of the output device used. Because of this, a PDF with vector graphics can be viewed at various magnifications (effectively different resolutions) with no degradation or loss of quality.

Common formats for vector graphics include WMF, SVG, CGM. Authoring tools, such as Microsoft Word or Adobe FrameMaker, include their own vector graphics tools, which are directly carried to the PDF during distilling.

Some vector formats (WMF for example) support bitmaps as a component. EPS can contain both vector graphics and bitmap graphics.

Following are general recommendations and guidelines to improve the handling of graphics in your PDFs:

Starting Point: Original State of Graphics

Make sure that your original graphics has the level of detail or color depth needed.

Graphics quality can only deteriorate during conversion to PDF, or when the PDF is displayed. If the original graphics is not of sufficient quality, nothing will help. Be aware also that saving original graphics in some graphics formats will either reduce the number of colors (eg GIF) or cause an irreversible loss of image data (JPEG).

Distiller Job Options

The "Compress Text and Line Art" setting in the Distiller Job Options affects only vector graphics. This setting should always be selected, as the compression of text and vector graphics is lossless.

As to bitmap compression/resampling, you must make a choice based on the current state of the graphics and the intended uses of the PDF. As a minimum, lossless compression should be used (Zip, 8-bit). But as lossless compression is often not good enough in terms of compression ratio, lossy JPEG compression may be used, depending on the image properties and after carefully inspecting the impact of the different quality settings on various images used. Resampling may be effective if your graphics has a resolution that is much higher than needed, such as 600 dpi (alternatively, you can resample specific images in a graphics program).

Close familiarity with the type of graphic information and the context of uses is essential. For example, JPEG compression, even of the highest quality, will damage delicate medical images to be analyzed by experts; on the other hand, its effect on general-purpose background images may not be noticeable, even when medium/low quality compression is used.

As a general recommendation, the "Color Management Policies" (Distiller, Settings > Job Options, Color tab) should be set to "Leave Color Unchanged". [Acrobat 5 CD] "Acrobat Forms Field Naming Hints" (Naming.pdf) demonstrates downsampling job options that cause the text in the screen capture (page 2) to be unreadable when displayed or printed.

Screen captures in "Online Comments" (OnlineComments.pdf) underwent lossy compression resulting in "blotchy" areas and unreadable text. A similar problem is present in Screen captures in "Acrobat JavaScript Guide" (AcroJS.pdf, version 5.0.5), pages 289 and forward. Interestingly, the corresponding screens in the previous version of the same document (5.0, pages 287 and forward) do not suffer from this problem, and are displayed and printed reasonably.

Rewriting the PDF file

Make sure to rewrite the PDF (Save As, overwriting the same file), as this operation may improve the internal storage of graphics significantly. For example, an identical graphics included on every page will be stored only once and reused as necessary.

Acrobat/Reader Preferences

Although you can provide the PDF user with guidelines for setting local preferences for optimal viewing quality, it is likely that most Acrobat Reader users do not change the default display preferences (these are local to the specific computer, and cannot be controlled from a PDF file). It is best, therefore, if you plan the graphics so that they will be displayed reasonably with the default settings.

Smoothing Preferences

Smoothing, also known as anti-aliasing, softens the edges of graphics shapes and text in order to minimize the contrast between the background and the text or graphics.

Smoothing often improves on-screen display, but some people find smoothed graphics or text appear out of focus and prefer to turn the specific option off.

"Smooth Text"

Default: on. It applies to all text items, which may be present in vector graphics, or to text items serving as graphics (symbols or icons).

"Smooth Line Art" (Acrobat 5)

Default: off. This preference improves the display of most vector graphics, but it may cause some thin lines to become gray. It also slows down the display, to some extent.

"Smooth Images"

Default: on. The image smoothing option improves the display of some bitmaps (depending on the original image resolution and the current magnification).

Use this PDF file to experiment with the impact of smoothing on different graphic types.

Accessibility Preferences (Acrobat 5)

Some users may change the default color schemes to improve readability, and select their own colors for text and for page background. Black or "almost" black text will be displayed in the color specified for text; text in other colors will be left as is. When the page background color is specified to be non-white, the solid white fill of vector objects or white backgrounds of bitmap images (such as a bitmap displaying a triangle button) becomes noticeable and may be visually disturbing.

With vector graphics, you can use transparent or "no fill" settings to prevent the opaque white presence. This applies to graphics objects as well as to frames used to hold text or graphics in your authoring application.

[Acrobat 5 CD] "Acrobat Forms Field Naming Hints" (Naming.pdf) has graphics with a white fill (page 1), and table cells with solid white background (page 2) -- these become visible when accessibility colors are selected.

"Acrobat Core API Reference" (CoreAPIRef.pdf) has solid white footer frames on almost all pages, as well as a solid white background above all major headings. When viewing the "Core API Overview"(CoreAPIOverview.pdf) with custom colors, very large letters (APTER) show up on page 107, and the word APPENDIX shows up on page 193. White change bars (page 58 and forward) become visible.

Graphic Functions

It is widely accepted that well-designed graphics can improve communications, especially when dealing with technical subjects. This is even more applicable to on-screen documents than to paper-based documents, because of different reader expectations and reading patterns (readers tend to scan screens even more than pages, and have a shorter attention-span for long paragraphs).

Which graphic format is better for PDFs: bitmap or vector? There are several considerations when deciding which format to use, first and foremost depending on the function of the graphics. The use of these main function categories in PDFs will be discussed:

  • Photographs (such as a product or person)

  • Screen captures

  • Illustrations (such as diagrams, flow charts, graphs)

  • Interface graphics (such as buttons, icons and navigation maps)

  • Company logos

Photographs

The display quality of photographs depends on the quality of the original photograph (resolution, color depth) and on the display zoom.

Acrobat's display resolution at 100% zoom is 72 dpi. When you view an image present on a PDF page at a 100% zoom, the higher resolution an image may have will not be of value. As the display resolution cannot be changed, "hardware downsampling" effectively takes place - where different pixels are omitted.

However, the higher resolution will cause a slower display and a larger file size. Higher resolution images will be beneficial when you print the page or when you zoom in - a 400% zoom will mean an effective resolution of 288 dpi, for example.

Bitmaps in a PDF file are displayed with optimal quality only at a specific effective resolution. Changing the magnification (the same document may open with different magnifications in different computers based on view settings and preferences) will have an immediate effect on bitmaps. (This differs from display of bitmaps in HTML pages in web browsers, where the same 100% magnification is used at all times, so that image distortion is not possible.) Depending on the page size and text layout, it may be better to display optimized graphics in a separate window. To do this, store the graphics in a separate, "dedicated" PDF with a default 100% zoom, and link references from the textual PDF to the graphics. This way, the zoom level of the text document can be specified differently from the graphics.

Reference to graphics can be linked to figures placed in a multi-page PDF. Alternatively, if each figure is displayed in a separate PDF, it can have a unique title (displayed in the title bar).

The target PDF can be displayed in a new window (overriding preferences). When this PDF is closed, the text document is displayed in its previous location.

Meaningful Resolution

When you integrate images in your authoring application, make sure to use a resolution that will match your PDF needs. If the PDF is primarily designed for on-screen display, use resolutions that will make the image display well in 100-200% zoom. If print is intended as well, higher resolutions will be needed. (in addition to actual printing, you can also have an idea as to how an image may print by inspecting the PDF at 300% zoom.)

Need both display and print? You may have a "compromise" approach where the resolution is a bit higher than needed for display purposes, and not too low for printing purposes (e.g. 150 dpi). Alternatively, in PDFs with lots of images, you may have two different PDFs: one optimized for print, and the other optimized for screen. (The same source file may be distilled with different downsampling job options to achieve the appropriate image resolutions in the PDF)

Dynamic Image Interpolation for Photographic Images

"Dynamic image interpolation" improves the visual result and is recommended for photographic images, especially when these will be used at higher magnifications. When the resolution of a image is significantly lower than the effective display resolution, image interpolation attempts to produce a smooth transition between adjacent pixels, reducing "jaggy" or "blocky" visual artifacts.

Dynamic image interpolation can be turned on for a specific bitmap through the EPS export in Photoshop, or globally -- for all bitmaps in the PDF being distilled -- through a special command in Acrobat Distiller's prologue.ps file. This setting is best applied individually, providing you with a higher level of control. For example, you can have all background graphics or photographs created with interpolation turned on, and screen captures without image interpolation. Note that the dynamic image interpolation somewhat slows the display. Image interpolation may cause text to appear "foggy" when the PDF is displayed at standard magnifications. [Example (PDF: 362kb)]

Callouts

If your photograph includes callouts, consider implementing these through text in your authoring program, rather than as part of the bitmap image, for these reasons:

  • Bitmap text is adversely affected by downsampling and display distortions and is often rendered unintelligible.

  • Bitmap text cannot be searched with Acrobat's Find or Search functions.

    If you have lines pointing to specific items in a bitmap, consider adding a white border for lines crossing dark areas (where the line merges with the background).

  • Avoid diagonal lines/oblique angles as much as possible, because of the "staircase" effect. Alternatively, use diagonals with 45 degrees (or 30 or 60 degrees as a second choice).

[Acrobat 5 CD] "Acrobat JavaScript Guide" (AcroJS.pdf) demonstrates the jaggy display of callout lines drawn at arbitrary angles (page 279 and following pages). The "staircase" effect is somewhat reduced when the viewer turns on the "smooth line art" preference, but it is still noticeable. Most, if not all, of these callout lines could have been drawn as straight lines.

Screen captures

Although screen captures are a kind of photograph, they are used - and misused - so often that they warrant discussion as a separate category.

Screen captures are so common in technical documentation that we tend to overlook the fact that they are not always necessary. Your first consideration should be whether the screen capture is necessary at all, and if so, whether a schematic drawing can do a better job.

When you do decide to use screen captures, follow these guidelines:

Capturing the screen

Turn off text anti-aliasing smoothing in your operating system (or the ClearType rendering option in Windows XP) before taking the screen capture, so that the captured image is as clear as possible.

Color schemes

Consider using a different set of colors in screen captures to identify these as static.

If not necessary, don't use the entire screen

Unless the entire screen is necessary, consider showing only a "cut-out" of the relevant section. This helps to focus the user and to remove excess "noise".

Resolution

For a screen capture to look best at a zoom level of 100%, it has to be incorporated into the page (at the authoring stage) with a resolution of 72 dpi.

The screen capture will then be displayed as intended at a zoom of 100%, and with the least distortion at zoom multiples of 50%.

When screen captures are viewed at arbitrary magnifications, the display results can vary significantly, and this is particularly evident in the text. This is the case when the zoom level is set to "Fit Page", or "Fit Width". If you wish to display the screen captures optimally, you may want, at least initially, to set the default zoom of the PDF to 100% (or any other specific value matching the resolution of your images).

Example: Using a "picture viewer" to display optimal screen captures (links in text, PDF: 53K, point to screens, PDF: 47K). When displayed in Acrobat/Reader (not through a web browser), screen captures are displayed in a separate window (overriding the "Open Cross-Document Links in Same Window" local preference).

In any case, it is important to inspect the text quality at various magnifications, as well as in print (if print is intended).

[Acrobat 5 CD] Screen captures in "Programming Acrobat JavaScript Using Visual Basic" (VBJavaScript.pdf), pages 4 and 7, are displayed best at a zoom level of 135 percent, due to the resolution at which the images were integrated in the authoring stage. It is not likely that these zoom levels will be used by default when opening the PDF.

"Acrobat Forms Field Naming Hints" (Naming.pdf) demonstrates downsampling job options that cause the text in the screen capture (page 2) to be unreadable when displayed or printed.

Acro5NamingCapture

Dynamic Image Interpolation

Acrobat's Dynamic Image interpolation is not recommended for screen captures or other bitmaps that include text. When used with common zoom levels, interpolation makes the text fuzzy or "greyish" - when displayed and possibly also when printed.

Illustrations

For the most part, illustrations are displayed better as vector graphics than as bitmaps.

However, as much as possible, try to refrain from using diagonal lines/oblique angles, because of the "staircase" effect ("smooth line art" will minimize this effect). Shapes made of vertical and horizontal lines will be displayed better. If diagonals are essential, use diagonals with 45 degrees (or 30 or 60 degrees as a second choice).

If you use complex vector illustrations (such as engineering drawings originating from CAD programs), you may experience extremely slow display (related to numerous fragments) or undesired "display-by-layer" effects". Simplify such vector graphics as much as possible; if this is not possible (for example if the original was created in a 3-D program and then converted to DXF), consider converting specific illustrations to bitmaps when the primary use is on-screen display (experiment with scaling the vector graphics before conversion to bitmaps). Be aware that after conversion, print quality may be affected and text objects will not be searchable (although often the text in engineering drawings is composed of strokes and is not "real" text).

Text in Illustrations

If your illustrations or charts include text that users may want to search for, or if you want to make sure that the text is displayed as best as possible at various magnifications, avoid the "convert text to outlines" function in your graphic program. This damages text display and will also prevent access to the text when using Acrobat's Find/Search functions.

Patterns & Fills

Most patterns and hatches (such as those available in FrameMaker, Word or Excel) are substituted with shades of gray, or disappear altogether, when converted to PDF.

There are variations, related to applications, printer drivers used and specific Acrobat releases. (In some cases, Type 3 bitmap fonts are used to simulate patterns -- with gray stripes at normal magnifications, reasonable display at large magnifications, and slower rendering.) Even PostScript patterns are not displayed correctly at lower magnifications, sometimes looking like a solid black or white box.

Semi-transparent fills from Microsoft Office documents are not displayed correctly (opaque if the PDF is created with Acrobat Distiller).

Gradient fills often end up in PDFs as hundreds or thousands of vector items working together to achieve the specific gradient fill effect. If applicable to your drawing or authoring application, check whether Distiller's Convert Gradients to Smooth Shades is selected (Settings > Job Options > Advanced).

Inconsistent display of line thickness

Acrobat frequently displays lines of the same weight at varying widths. This distortion only applies to display, and varies with magnification (thin lines in one magnification may appear thicker in another magnification, and vise versa). Using the thinnest lines supported by your graphics/authoring program may reduce the problem, but does not solve it. Setting the default zoom of the PDF to a multiple of 50% may also help.

Acrobat supports the PostScript setstrokeadjust setting, which was introduced to improve line thickness consistency in lower resolutions. But this has to be supported at the authoring application level as well as carried through the distilling process.

While display results with setstrokeadjust enabled are generally much better, line width consistency is still not guaranteed at all zoom levels. In addition, as a result of display bugs, some lines may gain extra length when this option is activated. [Example (PDF: 18kb)]

Interface items (such as buttons, icons, etc.)

For optimized display of smaller, repeating items, consider using characters from symbol fonts or custom fonts. Display of these will generally be better than vector or bitmaps, especially as text smoothing is turned on by default and as it is generally implemented more efficiently than smoothing of bitmaps or vector graphics (if enabled).

Note however that recent Adobe PostScript drivers for Windows 2000/XP may fail to process custom fonts (omitting these characters altogether), so check this with your specific combination of tools.

[Acrobat 5 CD] The Acrobat 5 Help file (AcroHelp.pdf) has next/previous page icons that appear in the header and footer of all pages, implemented as vector graphics. Integrating these icons as characters from a font would have improved display (when smoothing of vector graphics is turned off by default). A related aspect: when the PDF is displayed with accessibility options which change the document colors, the buttons appear as rectangles.

Company logos

As smoothing of vector graphics is turned off by default, logos implemented as vector graphics may exhibit lower-quality display, especially when the graphics is in small scale.

For optimized display, consider having a company logo implemented through a font (integrated as a character in your authoring application), or as a bitmap.

Interactivity aspects relating to graphics

Entries in the List of Figures (together with other key navigational items, such as Table of Contents, Index, List of Tables), as well as cross-references to figures, should be linked to the corresponding figures, so that items are easily accessible when reading the document on screen.

A common practice is that links point to the figure title (typically the result of a cross-reference to a paragraph holding the title). When such a link is clicked, the figure itself may not be displayed in full. For optimal performance, it is best if the link has the figure itself (graphics plus title) as a target (a non-printing Back button may be implemented as a special icon in the graphics area). [Example (PDF: 170K)]

In terms of bookmarks, which provide an on-going and easy access to all key headings and items, the List of Figures itself should be bookmarked, as a minimum.

Specific bookmarks pointing to the figures directly may be useful in publications with many titled figures, intended to be used frequently. But, to be effective, such bookmarks to figures must not be "mixed" with other bookmarks according to the location of the figures, often collapsed under lower-level headings. Instead, a separate list of figure bookmarks under a corresponding heading is much more efficient - simulating the List of Figures in printed books. [Example (PDF: 117K)]

Mostly applicable to complex graphics, it is also possible to have bookmarks that display specific areas in a figure. [Example (PDF: 63K)]

Within the graphics itself, references to other document parts can be linked as needed. In the case of troubleshooting diagrams or flowcharts, for example, each box may be linked to the corresponding procedure (and marked as a link). In the case of a drawing of a machine, for example, clicking each part may take the reader to more information on that item, with "tool tips" or rollover text providing additional information on the link target or highlighted part. The display of specific label only when the cursor points to a specific part improves usability and helps reduce the clutter. Such a hyperlinked diagram can serve as a visual "table of contents", in additional to a text-based listing.

Display: Interaction through thumbnails

Acrobat's thumbnails may be very useful with larger graphics, as they identify the viewed area within the graphics in the form of a red rectangle in the thumbnail. The red rectangle can be dragged by its border, with an immediate change of the displayed part and continuous indication on the viewed part in the larger diagram. Dragging the box at the bottom-right corner of the red rectangle in the thumbnail will adjust the zoom level.

Starting with Acrobat 5, thumbnails are generated dynamically when opening the PDF in Acrobat or in Reader (but not when the PDF is displayed through a web browser).

Thumbnails can be embedded in the PDF for the benefit of users who view PDFs through a web browser or use previous Acrobat/Reader versions, or for a slightly faster display. Embedding the thumbnails increases the file size, typically in the range of 6-12K per page. Acrobat Distiller can create thumbnails and embed them in the PDF being distilled, but these are of lower quality compared to the thumbnails displayed/embedded in Acrobat itself.

Thumbnails can also be useful when viewers are interested in locating a specific illustration in graphics-intensive documents. In such documents, a default opening mode showing thumbnails may be a better are a better choice than bookmark display.

Zoom-in/sequence using Acrobat articles

Acrobat articles can be used to zoom-in on a specific figure, if that figure is defined as a single-rectangle article. Clicking the graphic area will zoom in to show as much as possible in terms of magnification. Clicking the article area again will show additional parts of the graphics if not currently displayed (depending on the maximum zoom specified and graphics size) or go back to the regular view if the article area was viewed in full. [Example (1-page PDF in a 38K zip)]

Related graphics can be linked to form a single article thread (each graphics being a separate rectangle), enabling easy navigation between the different items.

Tooltips

Tooltips can be used to display brief information on graphics when there is no immediate information above/below the graphics, to display additional information (e.g. effective dates), or to provide brief information on the purpose of buttons/icons. [Example (PDF: 308K / 7 pages; Acrobat/Reader 5 required)]

Movies

Movies open up additional graphics display and interaction capabilities. QuickTime movies with multiple still images ("slide shows") can show sequences of images, such as "before/after" or steps in a process. QuickTime "virtual reality" movies enable the reader to inspect an item from different view points, zoom in/out on items of interest.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Two Passwords Are Better Than One: The Low-Down On PDF Security

For people who don't spend their time looking at PDF files in text editors*, PDF security is a sometimes misunderstood beast.

For example, those document restrictions that PDF files sometimes have -- no Printing, Content Copying, Page Extraction, etc -- are essentially useless unless the PDF also has a User Password.

January 09, 2014
Platinum Sponsor



Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist 11

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.