Tips on Using Graphics in Word Templates

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 the template, you may notice that their inclusion adversely affects template size and performance. A 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.

Word stores any graphics in a .DOCX file in a compressed format that is close to the size of the original imported image. The RTF format, however, is a character-based document format, so graphic images must be converted to character strings. When images are large, have high resolution, or are of certain difficult-to-represent formats (particularly bitmaps), they become very large in RTF files.

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

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 picture, you should use JPG. For simpler images, like illustrations or icons, you can use GIF. Do not insert uncompressed files such as Bitmaps (.BMP) in the template.
  • Save graphic files in the lowest acceptable resolution. Resolution for an 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.
  • 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.

Keep Word from Storing Metafile Versions of Your Graphics in RTF

According to a Microsoft Knowledge Base article, "if an EMF, a PNG, a GIF, or a JPEG graphic is inserted into a Word 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 problem, you can specify a Windows registry setting that keeps Word from saving two copies of the image.

You must be extremely careful when working in the Windows registry. Failure to follow the instructions below exactly could result in your making changes that negatively affect all of the programs on your computer. You may want to ask your system administrator for help if you are unsure of what you are doing.

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 box appears.
  3. In the Open field, 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 field, 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.

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.

This same behavior can also happen when selecting the Different Odd & Even Pages option

Conclusion

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

  1. Use DOCX templates where possible or use an image file format that works well in RTF files. Generally this is JPG, although some types of images (e.g. line drawings) may be smaller in another format.
  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.