OUTLINE - PDF outline

Top  Previous  Next

UnForm supports PDF outlines (or bookmarks) when using the pdf driver.  Outlines can be multiple levels, and each outline tree can be different levels deep.  UnForm assumes each outline branch points to a page.  To control the text shown in the outline, you set the variable outline$ in a prepage or precopy code block.  This variable is parsed as each page is printed.  Multi-level entries are created by delimiting the text of the levels with a vertical bar (|) within the contents of the variable.

 

The file sample5.txt contains the contents of a 14-page report featuring two sort and subtotal levels, as well as grand totals and a recap page.  The outline tree for this report will be based on the salesperson (outer sort) and class code (inner sort), along with specific page entries for the report total and recap page.  As there are no detect statements, you need to specify the –r option on the command line, as shown.

 

uf90c –i sample5.txt –f advanced.rul –r outline –p pdf –o client:outline.pdf

 

[outline]

 

Set the page dimensions and turn on the outline feature with the outline keyword.  The default outline title for each page is simply "Page n", but a code block can override the outline text by setting the variable outline$.

 

cols 132

rows 66

outline

 

The prepage code block looks on each page for the following cases, in order:

A 3-digit salesperson number at the first column on line 7
A salesperson subtotal heading on line 8
A report total heading on line 8
A recap page heading on line 2

For the first two types of pages, a two level outline entry is created (level 1|level 2 structure).  For the report total and recap pages, a single level outline entry is created.

 

prepage{

# default outline setting matches prior page

outline$=lastoutline$

 

# if line 7 starts with 3 digits, set 2-level outline slsp+class

if mask(get(1,7,3),"[0-9][0-9][0-9]") then \

outline$="Slsp "+get(1,7,3)+"|Class "+get(13,7,2)

 

# if line 8 contains this, it is a salesperson subtotal

if pos("SALESPERSON: "=text$[8])>0 then \

outline$="Slsp "+get(14,8,3)+"|Totals"

 

# if line 8 contains this, it is a report title

if pos("*Report"=text$[8])>0 then \

outline$="Report Total"

 

# if line 2 contains this, it is the recap page

if pos("RECAP PAGE"=text$[2])>0 then \

outline$="Recap Page"

 

lastoutline$=outline$

 

}