Module 8: Working with Pre-Printed Forms

Genero Report Writer video scripts

Related video: Working with Pre-Printed Forms (GRW)

Description: You’ve seen how to create a form-based report that uses an image of the form to provide the background. This video shows you how to design your report to suppress the form image when printing on the form paper itself.

Tags: Genero Report Writer, form report, form, pre-printed form, report output

Time: 6:58

Presentation

Script

Intro splash

Slide

In this presentation, you will learn how to print directly on pre-printed forms.

Demo

In the Reports project, there is an example of  a form-based report,  where a form image is used as the background of the report, and the form data is  placed on that image using absolute positioning.  This report – the OrderStock report – outputs the form and the form data, which is quite useful when the report is being output as a PDF or displayed using the Genero Report Viewer.

What if you want to print the report data onto the actual form itself – when you have the physical forms to place into the printer prior to running the report?

This presentation assumes the following scenario: when output directly to a printer, the report will be printed on the form itself. When output to a file or to PDF, the form image must be used in lieu of having the actual form.

At the end of this presentation, you will see how to modify the Report Design Document so that the form image is suppressed when output to the printer, yet maintained when printing to a file or to PDF or to the Report Viewer.

Demo

Start by examining the the OrderStock report.

When you examine the Report Structure, navigate and look under the OnEveryRow trigger, where you find a horizontal layout node. The X-Size and Y-Size properties of this horizontal layout node are set to MAX, meaning that it takes up the complete minipage on which it is placed.

The horizontal layout node contains the template image. It is an ImageBox that has been configured to sit at the top of the layout node, vertically centered. In this report, it does not span the whole layout node, instead only taking up the 10 cm by 13 cm needed for the form itself.

The report record data has been placed onto this form image using absolute positioning. You can tell it is absolute positioning by the appearance of the red dot, which is the anchor for this object. The X and Y properties of the data element sets its absolute positioning with respect to its parent – in this case, the ImageBox.

When you run the report, each record provides the data to complete one report page, which is displayed on top of the form image. You end up with one completed form per record, thanks to the use of the form image in the report output.

Slide

To meet the new objective – to suppress the use of the form image when output to the printer – you need to modify the report design. The goal is to output the form image only when NOT going to the printer.

The steps listed on this slide will guide you in meeting this goal.

  1. You can start with the OrderReport, which currently includes the form image for ALL output.
  2. Create a copy of the ImageBox
  3. Move the copy above the initial ImageBox – they remain siblings, but the copy sits above the original.
  4. Delete the children – the data objects – from the copy
  5. Use an expression to set the visibility condition of the copy of the ImageBox to NOT print when output to the printer. This is done by using the producingPrinterOutput() method of the Runtime class. This method returns TRUE when the printer is the specified output. You need to set the expression to state that when it is NOT Runtime.producingPrinterOutput() – when you are NOT sending to the printer – then this ImageBox is to be printed.
  6. You need to then convert the initial ImageBox into a Layout Node. It maintains the same size and location, but no longer displays the image. It contains the child data objects – the WordBoxes and BarCodes displaying the record data. If these children had remained under the ImageBox, they would also be removed when the visibility condition was not met. It is important to remember that a visibility condition removes the complete fragment tree starting with the element on which it is defined.
  7. As the last step, you would save the report.

Demo

Follow along with this demonstration to see how easy it is to complete this report modification.

You should save a copy of your original report file, so that you can return to it if needed. Assume that this has been done prior to this demonstration.

You open the OrderStock.4rp file, and use the Report Structure to locate the ImageBox holding the form image.

You copy that ImageBox and paste it as a child of the parent LayoutNode.

You move the ImageBox copy so that it sits above the initial ImageBox.

You remove the children from the ImageBox copy.

You use the Expression Editor to set the Visibility condition. If it is NOT being output to the printer, then you want it included. The NOT condition is set by the exclamation point, and you enter the producingPrinterOutput() from the Runtime class to return our boolean of TRUE or FALSE.

You use the Convert To menu option to convert the original ImageBox to a layout node.

The report modifications are done.

Once you save your changes, the report is finished. If you output to a printer, the form image is not printed. If you output to PDF or SVG, however, the visibility condition results in TRUE and the form image is output along with the form data.

Outro

I hope you have found this demonstration informative. Be sure to check out the other Genero Report Writer videos.