48
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 119
Adding Bookmarks Using Crystal Formulas as Tags [New Approach]
Using a command line argument, you can instruct Visual CUT to look for invisible tags inside
the pdf file (Crystal formulas with font color set to background color) and to use their content to
generate bookmarks. Compared to the old approach (described in the previous section), this new
technique has several advantages:
1. The bookmarks link to the exact vertical location (on the linked page) where the
rendered formula is located. In the old approach, bookmarks only pointed to at the top of
the page.
2. You can easily generate bookmarks from within subreport and from any report
section (not just Group Headers). For example, you can generate bookmarks from Detail
Sections or Group Footers.
3. You can control the bookmark text color more completely (instead of a few color
constants, you can specify any color using RGB (Red/Green/Blue) values.
4. You can control the expanded/collapsed state of each bookmark node
5. You can control the style of the bookmark node (Regular, Bold, Italics, Bold&Italic)
6. No need to worry about PageNumber resets, Keep Together, and
WhilePrintingRecords properties that can cause headaches with the old approach.
This is because the new approach doesn’t
requ
ire specifying a page number and doesn’t
depend on the evaluation time of the bookmark formulas.
7. You can avoid the need to use a command line argument by setting
PDF_Bookmark_Tags_Default=True
under the [Options] section of DataLink_Viewer.ini (only applies to files < 100MB)
Visual CUT would then process bookmark tags within an exported PDF file.
Here's an example of the command line argument structure:
…
"PDF_Bookmark_Tags:c:\temp\Sales in {@Year_Parameter}.pdf" Or
…
"PDF_Bookmark_Tags:Source_pdf_file>target_pdf_file"
If only one pdf file is specified (as in top example), the source file becomes also the target file.
The Crystal formulas act as tags for controlling the level, vertical location, text, color,
expand/collapse status, and style (regular/bold/italic) of the desired pdf bookmarks.
Setting Up a Crystal Report with pdf formula tags
You can download a sample report demonstrating the technique from:
www.milletsoftware.com/Download/
Visual_CUT_PDF_Bookmark_Tags.rpt
And the resulting pdf file from:
www.milletsoftware.com/Download/
Visual_CUT_PDF_Bookmark_Tags.pdf
The sample report uses 3 formulas to generate bookmarks:
{@Bookmark_L1} is placed in the Group Header level 1 to generate Product Type Name bookmarks
with bold blue text. These level 1 nodes are expanded.
{@Bookmark_L2} is placed in the Group Header level 2 to generate Product Name bookmarks with
bold text. These level 1 nodes are collapsed
.