Antenna House Formatter can use a PDF page as a background image for an @page rule or applied via the page CSS property to a container element. At this time, you can use the PDF embedded as the background as a template and insert data on the background to generate and print a new PDF. For more information on embedding PDF, see PDF Embedding in the manual.
First, create a template PDF and the HTML/CSS to be merged data. Next, specify the template PDF in the 'background-image' CSS property of the @page rule definition as follows:
@page PageMaster-* {
size: 210mm 297mm; /* Example */
background-image: url("order.pdf");
}
The above example uses a page with a height of 297 mm and a width of 210 mm (via the `size` property), and displays order.pdf as the background on the entire page via the `background-image` property.
In most cases, the data to be inserted into the template is placed by specifying the absolute position on the page. Include the merged data in a `div` element (or similar block container), specify the position: absolute; CSS property, and then use the `left`, `right`, `top`, and `bottom` CSS properties to determine the absolute position of the `div` element as follows:
<div style="
position: absolute;
left: 10mm;
right: 30mm;
top: 50mm;
bottom: 20mm;
">...</div>
In the above example, the `div` element is positioned 10mm from the left, 30mm from the right, 50mm from the top, and 20mm from the bottom relative to its containing block.
In this sample, the following PDF is embedded as the background of the second page as a template, and the data is inserted into that PDF.
Antenna House
1234567-1234567
dd/mm/yyyy
750
1 | Product-1 | 10 | 30 | 300 |
2 | Product-2 | 5 | 50 | 250 |
3 | Product-3 | 8 | 25 | 200 |
4 | ||||
5 | ||||
6 | ||||
7 | ||||
8 | ||||
9 | ||||
10 | ||||
750 |
Sample