Print an electronic form behind PDF output
Add the blank form as a picture resource and print it first. APPX prints the report fields over the picture. Check page two as well as page one when testing a multipage form.
- Define a PDF form with the intended page size, orientation, margins and spacing. Select it as the preferred form for the OUTPUT.
- Place a Picture widget for the form resource on the PAGE-START image. Use the frame and image settings below to position the data over it.
- Generate a sample PDF at the intended size. Check a field near each corner before laying out the rest of the report.
How to create a PDF Form Overlay
by Gary Rogers, APPX Director of Training and Consulting There have been a lot of inquiries on how to create a form overlay in APPX. A PDF form overlay is a predefined image, or electronic form, that is printed underneath the data associated with the process. The use of form overlays eliminates the need for preprinted forms or creating the forms from scratch in Application Design. This article explains the basic concepts of creating an output process using a form overlay. In most cases when data and a form are merged the data is printed first and the form is laid over the data (thus the term overlay). APPX works exactly the opposite. The form is printed as an image, and then the data is printed on top of the form. It is best if you can find an image that is scaled close to your form size. The less scaling that needs to be done when the PDF output is created, the less chance you will have blurred or distorted images. It may also be necessary to create a form definition in System Administration that matches the size of the image you are using. I have a PO form that prints on a letter sized page. I added a form named PDF-6P10 that is a type PDF with a form length of 60 lines and a width of 80 characters. On the second page of the Forms definition, I set the top and bottom margins to .5 and the left and right margins to .25. The overlay image is a .png file named POForm.png. Although Appx accepts .jpg, .gif and .png images, .png images are recommended as they provide a more portable format, good compression, and you will not have to be worried about active channels and other image related issues.- The first step is to obtain or develop the electronic form you wish to use in your output process and create the APPX form definition as described above. You can scan a form, but it is very difficult to get the scanned image straight.
- Place the image where it will be accessible to your process. The most convenient location is the $APPXPATH/vv/aaa/Resource directory where vv is the application version and aaa is the application id.
- In Application Design add a Named Resource (PO FORM). The State will be ENABLED. That is the active state when creating a PDF document. Set the Type to the value that will point to where you placed your image. In this case I chose Design File since the POForm.png file is in the Resource directory. If you place all your images in a common location you may need to use Server File. The Location is the name of the image file, POForm.png. If you use any Type other than Design File you will need to enter the fully qualified path to the image. On Linux or Unix platformst, make sure that you match the case in the Location to that of the actual file name in the Resource directory.
- Now create an output process. In this example the form is letter size so the output process would be designed with Columns set to 80, Standard Page heading set to No, Standard Column headings set to No, and the default Separator character (=) would be removed.
- Set the Preferred Form in Additional Attributes with the form name added for this image, PDF-6P10 in my example. This is an important step. The Image editor will scale the image in design to the size of the preferred form so what you see on the screen will be in the same aspect as what prints. If you do not use a default form APPX will use a form defined to print on an 8 1/2 x 11 page with portrait orientation, 6 lines per inch, and 10 characters per inch.
- Select PAGE-START for the first output frame and set the rows for the image to the length of image you will be using. In this example the form is length 60.
- Navigate to the image editor and select the Picture icon from the toolbar. Starting in row 1, column 1 drag out a box the size of the entire image editor display area. You only need to enter the Resource name you added above, PO FORM in the GUI attributes screen (don't forget to include the Application ID). If you like, you could set a border type and color. Click the Save button to get back to the image editor.
- Page the image editor screen down a page (Ctrl-down arrow) and drag the bottom of the Picture widget to the bottom of the display area. Repeat this step until you are at the bottom of the display area, line 60.
- If the image is not in scale you can edit the Picture properties and set the scale to a number that fits your liking. This might be a trial-and-error process until the image looks the way you want. If you cannot get it to look right, it may be necessary to adjust the image with an editing tool, such as Paint or Photoshop. There are literally hundreds of editors available, free and otherwise.
- Save the image and return to the Frame level. Reset the rows to 1, or to the number of rows needed for any data you will print in the heading.
- Add frames as needed to complete the output process. Place the fields on the image area for each frame, starting in the row and column locations based on the layout of your form. This may not be exact to your form the first time you print it out, but you can use micro-adjustments to place the fields exactly where needed.