Creating the Template
You can create a Google Docs email template file as described here.
Viewing or Editing the Template
Once the template is created, click the View button to view or edit the template.
Template Formatting Tips
The following tips may help you control the appearance of your PDF attachments.
- Under Format > Line spacing, reduce the line spacing to Single if it is currently larger, such as 1.5, Double, etc.
- Under Format > Line spacing, remove Add space before paragraph and Add space after paragraph.
- Under Format > Paragraph styles, change the header formatting to Normal Textrather than Heading 1, Heading 2, etc. Then apply formatting to control the header's font size, color, boldness, etc.
- Remove any excess blank lines.
- Under File > Page setup..., check the page size and margins. For example, consider setting the page size to A4 and reducing the top and bottom margins.
Google Docs Template in HTML Format
The Google Docs template is read in HTML format when it is retrieved by AppSheet. AppSheet then replaces the template variables in the HTML template with the data values you specify. The resulting HTML document becomes the email body or attachment. For email attachments, we convert the HTML document to PDF format and add the result as the attachment.
When you are designing your template, it can be helpful to see what your template looks like in HTML format. This allows you to fine tune your Google Docs template to yield better looking HTML.
- Open the template in Google Docs.
- In the Google Docs File menu, click Download as and select Web Page (.html zipped).
- If you are using the Chrome browser in Windows, the browser will download the file as a zip file and display a message at the bottom of your browser window.
- Click the up arrow and select Show in folder.
- Right-click on the zip file and select Extract All .... This will extract the HTML file from the zip file.
- Double-click on the extracted HTML file to view it in the browser.
Page Breaks in PDF Attachments
You can include page breaks in the PDF file created from an attachment template file by manually inserting a page break in Google Docs.
- In Google Docs, position the cursor where you want the page break to occur.
- From the Google Docs Insert menu, select Page break.
Page Headers, Page Footers, and Page Numbering are Not Supported
Workflow templates do not support automatic page headers, page footers, or page numbering.
To handle automatic page headers, page footers, and page numbering, we would need to implement a “page layout engine” that computes the page location of each element being displayed. We would need to be aware of page boundaries, so that we could:
- Insert a footer at the end of each page.
- Insert a bottom margin at the end of each page.
- Insert a top margin at the start of each new page.
- Insert a header at the start of each new page.
- Insert appropriate page numbers.
We do not support any of these features because implementing a “page layout engine” is a lot of work. It is not work that we have done.
Using Custom Fonts
You can use custom fonts in your Google Docs template file. The resulting PDF attachment file will use these custom fonts.
Do this as follows:
- Open your Google Docs template file in Google Docs.
- From the fonts dropdown on the Google Docs menu bar, select "More fonts ...".
- In the "Fonts" dialog box that is displayed, look at "My fonts" on the right side of the dialog box.
- If the font you wish to use is not displayed, use the "Search" box to find the font. For example, you can use the "Libre Barcode" fonts. To choose one or more of these fonts, enter "Libre Barcode" in the "Search" box. This should display a list of five "Libre Barcode" fonts. Fonts you are using should be displayed in blue text with a checkmark to their left. If a font is missing, click it and the font should be displayed in blue text with a checkmark to its left.
- In your workflow template, select the text you wish to assign a custom font, and select the font name from the "Fonts" dropdown on the Google Docs menu bar.
- Trigger your workflow rule and ensure the PDF attachment is using the custom font.
Some customers have reported problems when using custom fonts. The PDF service sometimes fails to convert the HTML file to PDF correctly when custom fonts are present. The resulting PDF document may not display the text using the custom font at all. If you encounter problems with custom fonts, see Troubleshooting Custom Fonts .