eWebReports offers a very intuitive and easy to use report designer. However it is not uncommon to want information from your database to be added onto forms or invoices other companies, governments or clients provide. It would be a huge waste of time to try and recreate these forms yourself when all you want to do is fill them in.This problem can be solved with the Document Template tool in the report designer. This post will cover how to make a receipt template with a watermarked background and have eWebReports build a PDF that has been filled in with sales information from our database.

If you are working with a template that has already been created put it in your report folder and skip the Set Up section of this post.

Set Up

Because we are not starting with a form provided by an outside source we must create a receipt template. We do this in MS Word leaving the spaces we want filled in with as __________’s. In our word document we can place a water mark image. Since we are making a receipt we will have it say “PAID” in large translucent letters behind the text. Our word document will look like this:

 

Using MS Word we save this file as a PDF. Although you can do the next step in any editor you like, we recommend using Adobe Acrobat Pro. Open the PDF file and click ‘Forms’ and ‘Add or Edit Fields’. Acrobat Pro will prompt to automatically make fields for most underlined spaces. Whether you specify the fields yourself or let Acrobat do the work it is important to give the fields intelligible names. If a field will be mapped to a repeating item (in this example Price will map to OrderDetails.Price) you must make several fields and use the naming convention name.0, name.1, etc. Once the fields are made, save the template to your Reports folder (the path specified in the Admin console).

Using Document Template Tool

Create a report with all the information you will want to have appear on your template. As shown in our example the report can include formulas. The result of the formula will be used to populate your template.

Our receipt contains order information such as the id and date, customer contact and shipping details, and which employee handled the transaction. In the Details Section (which repeats for each item in the order) we list the item, price, quantity, discount and total (using some simple formulas). Because it is possible to execute this report as a format other than  PDF we added in a logo and titles. For information on how to include all these elements into a report see our previous post on creating your first report.

Now we open the Document Template tool. Simply hover over the advanced tools and select the document template tool (pictured below).

This will bring up a menu to map the fields of the form to cells on your report. At the top of the menu use the drop down to select the template we want to use. Below this drop down are two columns. When you select a template, the left column will populate with the fields of the form. Each cell in the right column is a drop down menu we can use to select the cell from our report we want to map to the corresponding field on the left.  We then click ‘OK’. Now when we execute this report as a PDF it will populate the template instead of executing as a normal report would. Our finished receipt looks like this:

More Uses of the Document Template Tool

Though we created a PDF, the Document Template tool can be used to complete Excel or RTF templates. Other common uses of the Document Template tool are completing government forms such as W-2’s, W-4’s, 1099’s or placing data into precise locations of a blank template as to print on top of paper forms.

Happy Reporting.

Leave a Reply