Tips on Using Graphics in Word Templates

From HotDocs Wiki

Jump to: navigation, search

When automating templates, you often need to include graphics in the template. These graphics can represent company logos, illustrations, signatures, and so forth.

As you work with these files in RTF templates, you may notice that their inclusion adversely affects template size and performance. An RTF template without any graphics can easily jump in size from, say, 100K to 4 MB when you add a graphic file. This may happen because the size of the original graphic file is large even before you insert it, or it may happen because Word is copying the graphic and inserting it again as a metafile object. Additionally, sometimes graphics you insert in a header/footer may inadvertently be left in the header/footer, even if you think you have removed them.

Proper use of graphics in RTF templates can minimize and even eliminate many of these problems. The following sections describe some steps you can take to improve your experience.

Contents

Minimize the File Size of the Graphic Outside of Word

When adding graphics to your template, you should do all you can to minimize the size of the file before you insert it into the document. The following tips should help:

  • Save the file in one of the following compressed formats: JPG, PNG, or GIF. Which format you choose depends on the type of graphic you are inserting. For example, if you are inserting a photograph, you should use JPG. For simpler images, like illustrations or icons, you can use PNG. Do not insert uncompressed files such as Bitmaps (.BMP) in the template.
  • Save graphic files in the lowest acceptable resolution. Resolution for a photographic image printed on a laser printer should display well at 120 dpi (or dots per inch), but some may wish to go as high as 150 dpi. Resolution for line illustrations and diagrams may do better at 300 or even 600 dpi, but care should be taken that such diagrams are clean and have minimal dithering in order to enable good compression.
  • Crop and/or resize the file using a graphics-editing application. Even though Word includes tools for cropping or resizing the graphic directly in the document, these tools do not reduce the actual size of the file that is embedded in the template.

Note: Although it is always a good idea (performance-wise) to minimize the file size of graphics used in high-volume production documents, the DOCX format handles embedded graphics more efficiently than RTF. Consequently, HotDocs performance when assembling DOCX templates (in HotDocs 11 and later) is less impacted by large graphics than when assembling RTF templates.

Keep Word from Storing Metafile Versions of Your Graphics

According to a Microsoft Knowledge Base article, "if an EMF, a PNG, a GIF, or a JPEG graphic is inserted into a Word [RTF] document, when the document is saved, two copies of the graphic are saved in the document. Graphics are saved in the applicable EMF, PNG, GIF, or JPEG format and are also converted to WMF (Windows Metafile) format." Graphics stored in an RTF file in Windows Metafile format can be extremely large.

To resolve the problems, you can specify a Windows registry setting that keeps Word from saving two copies of the image in RTF files.

To Keep word from Saving two copies of Graphics in your RTF Templates

  1. Close Word (if it's running.)
  2. Click Start > Run. The Run dialog appears.
  3. In the Open box, type regedit and click OK. The Registry Editor opens.
  4. Navigate to HKEY_CURRENT_USER > Software > Microsoft > Office > Version > Word > Options. (Replace Version with the version of Word you are using.)
  5. In the right pane of the window, right-click and choose New > String Value from the shortcut menu. A new string is created called New Value #1.
  6. Rename the value to ExportPictureWithMetafile. (To do this, you can choose Rename from the shortcut menu.)
  7. Once the name is changed, right-click on the string and choose Modify. The Edit String dialog box appears.
  8. In the Value data box, enter 0.
  9. Click OK.

If templates already contain these extra metafile images, you can remove them using the Hidden Data Remover tool in HotDocs. See the HotDocs Help for more information on using this tool.

Note: Word embeds graphics in DOCX files very differently than how they are embedded using RTF. The double-embedding problem is therefore not an issue for DOCX templates in HotDocs 11 and later.

Use Graphics in Headers and Footers Correctly

Often, you design your templates using company letterhead. Frequently this letterhead includes a company logo or icon, which you choose to include on the first page of the document only. In this situation, you would typically select the Different First Page option, and then remove the graphic from any subsequent pages in the document. Problems come if you later decide you don’t want a different first page header and you then clear the Different First Page option without first removing the graphic from the first page header. What happens is, Word assigns the headers from page 2+ to the first page so you can no longer see the graphic, but the graphic is still there. If you do not want graphics in your headers or footers, you must manually delete them before changing your header/footer options.

Conclusion

In short, make sure you adhere to the following rules:

  1. Use an image file format that works well in RTF file. Generally this is JPG, although some types of images (e.g. line drawings) may be smaller in another format (PNG or GIF).
  2. Size and crop images as required in the template before inserting them. Don't use Word's sizing/cropping or other picture manipulation features.
  3. Use the lowest acceptable resolution for images (in order to decrease file size).
  4. Insert images only where needed; avoid putting images in first page or odd/even headers that aren't used in the template.
  5. Implement the registry setting that keeps Word from creating Windows Metafile format copies of images in documents.