Getting familiar with the Embed PDF function
Below we will go through the steps of creating a PDF file looking like this:
The pdf file can be found here:
http://download.interform400.com/shares/public/InterForm400_embedded_files.pdf
The used resources can be found here:
http://download.interform400.com/shares/public/InterForm400_Embed_Definition_Demo.zip
The red arrows points to the links to the two kinds of embedded files. There is an embedded file for each detail line and a file containing the term of delivery. The links in the detail lines opens up an (embedded) image of the product. These image are embedded dynamically from the IFS when the PDF file is generated. The terms of delivery is a PDF file, which is also selected dynamically via information found on the first page of the original spooled file.
First we create an embed definition by selecting this in InterForm400:
5. Work with Auto Forms Control
7. PDF embedding definitions
Then we press F6 to create a new definition:
Change embedding definition EMB305D
Embedding definition . . : KITCHEN Description . . . . . . . Kitchen Embed demo Open action . . . . . . . 0 0 = Do not show attachment window 1 = Show attachment window
F3=Exit F12=Cancel
|
After pressing Enter we view the file types to embed:
Change embedding definition - file types EMB310D
Embedding definition . . : KITCHEN Description . . . . . . : Kitchen Embed demo Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display Opt File type Description PRODUCT Product image TERMS Terms of Delivery
F3=Exit F6=Create F12=Cancel
|
We press F6=Create to add a new one:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Select one of the following options:
1. Descriptions of file type to be embedded 2. Embedding model 3. Icon 4. Variables 5. Path to file(s) to be embedded
7. Variables in head page 1
9. Variables in detail lines 10. User exit program to find variable(s)
Option:
F3=Exit F12=Cancel
|
We want to condition the ‘terms of delivery’ on the customer type, so different PDF files will be embedded depending on this type. This information is found in a fixed position in the spooled file.
In option 2 we set the embedding model:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Embedding model . . . 2 1 = Embed a specific file 2 = Embed a file based on variables from page 1 3 = Embed a number of files based on variables in head of page 1 and variables from detail lines.
F3=Exit F12=Cancel
|
Via option 3 we set the icon to use as well as the size and position of the icon:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Icon type . . . . . . . . 6 1 = Paper Clip 2 = Push Pin 3 = Tag 4 = Graph 5 = Blue Underline 6 = Image from /APF3812home/Icons Where to place icon Page code . . . . . . . . 1 1 = First page 2 = All pages 3 = Last page Location on page From top . . . . . . . . 6,120 From left . . . . . . . . 6,100 Rotation . . . . . . . . 000 Icon size Height . . . . . . . . . 0,100 Width . . . . . . . . . . 0,100
F3=Slut F12=Cancel
|
Remember, that the position and size is written as inches and pels. We have chosen to use a specific image for the icon. This image must be placed in /APF3812home/Icons.
In option 4. Variables we define one variable:
Change embedding definition - variables EMB330D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Variable . . . . . . . : *V1 Description . . . . . . Terms Version Variable length . . . . 1 (1 - 30) Trim variable . . . . . *NO *YES, *NO Placement of variable . 1 1 = In head 2 = In detail 3 = UserExit
F3=Exit F12=Cancel
|
We intend to use a single digit to select between PDF files containing different terms of delivery.
In option 5. Path to file(s) to be embedded we select the files to embed, the name to call the file in the main PDF file, but also the image to use for the icon:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Path to file(s) /apf3812home/work/TermsOfDelivery*V1.pdf
Name of the embedded file inside the PDF-file Terms of Delivery.pdf
Image from /APF3812home/Icons to be used as Icon paperclip.jpg
F3=Slut F12=Cancel
|
The final thing we need to do for the terms is to tell InterForm400 where the variable (*V1) should be found in the spooled file in option 7. Variables in head page 1:
Change embedding definition - variables in head EMB335D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: TERMS Terms of Delivery
Variable . . . . . . . : *V1 Description . . . . . : Terms Version
Line number . . . . . . 3 (1-255) Left position . . . . . 72 (1-378)
F3=Exit F12=Cancel
|
We want to embed an image of each product referred to in the detail lines. The images are in this example placed in /apf3812home/work and named the same as the product ID with the extension .jpg. A special image is also used for the links here.
The embedding model is this one:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: PRODUCT Product image
Embedding model . . . 3 1 = Embed a specific file 2 = Embed a file based on variables from page 1 3 = Embed a number of files based on variables in head of page 1 and variables from detail lines.
F3=Exit F12=Cancel
|
The icon as well as the position and size are defined here:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: PRODUCT Product image
Icon type . . . . . . . . 6 1 = Paper Clip 2 = Push Pin 3 = Tag 4 = Graph 5 = Blue Underline 6 = Image from /APF3812home/Icons
Location on page From variable baseline . 0,005 Positive for downwards From left . . . . . . . . 0,180 Rotation . . . . . . . . 000 Icon size Height . . . . . . . . . 0,030 Width . . . . . . . . . . 0,030
F3=Slut F12=Cancel
|
The paths for images are defined below:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: PRODUCT Product image
Path to file(s) /apf3812home/work/*V1.jpg
Name of the embedded file inside the PDF-file Product_*V1.jpg
Image from /APF3812home/Icons to be used as Icon link2.jpg
F3=Slut F12=Cancel
|
Notice, that we are using a variable as part of the name of the embedded files in the main PDF file - and that we could also have used a variable as a part of the icon image if needed.
With option 6. Page layout input spooled files we define the lines, that should be considered detail lines:
Change embedding definition - file type details EMB320D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: PRODUCT Product image
Line number interval detail lines
First page . . . . . . . 25 - 43 Following pages . . . . 25 - 43
Type of detail lines . . . 1 1 = A logical line is one physical line, and all detail lines have the same format. 2 = Other
F3=Slut F12=Cancel
|
In this case all the detail lines are found in line 25-43 and the lines, that does not contain an ID are blank in the relevant positions:
Line Product Description Quantity Price Price -------------------------------------------------------------------------- 0002 ID4534 Kitchen cupboard 40x70 cm. 8 250.00 500.00 0003 ID7821 Kitchen sink white 40x80 cm 1 110.00 110.00 0004 ID5654 Refrigerator Freezedeluxe 1 1,234.00 1,234.00 Notice: 5 years free warranty 0005 ID6773 Oven HotFoodDeluxe 1 1,356.00 1,356.00 Remember: To be installed by authorized personnel only. 0006 ID3677 Induction Hob HotFoodDeluxe 1 1,444.00 1,444.00 Remember: To be installed by authorized personnel only.
|
So for the lines, where the product is blank InterForm400 will use blanks for the variable and try to embed a file called .jpg. As no such file exists on our system, then no embed/link is added for these lines.
Finally in option 9. Variables in detail lines we set the position of the variable, *V1:
Change embedding definition - variables in detail lines EMB340D Embedding . . .: KITCHEN Kitchen Embed demo File type . . .: PRODUCT Product image
Variable . . . . . . . . . . : *V1 Description . . . . . . . . : Product ID
Left position . . . . . . . . 13 (1-378) Control placement of icon . . 1 1=Yes
To change control of placement icon for this variable to *NO, change another variable to *YES.
F3=Exit F12=Cancel
|
By activating ‘Control placement of icon’ the final position in the output (even if it is remapped) of the text for this variable is used as a reference for placing the link icon in the final result.