48
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 123
Adding Page Numbers to a PDF File
You can instruct Visual CUT to add page numbers to the exported PDF file. This is useful when
also adding a Table of Contents (as described above) since in such a case the page numbers from
Crystal would be wrong. The command line argument structure is as follows:
…
"PDF_PAGE_N:2>10>10>11>Bottom>Center>Page_NofM>pdf_file>TimesBold"
or
…
"PDF_PAGE_N:2>10>10>11>Bottom>Center>Page_NofM>pdf_file>TT||Garamond||Bold||225;0;0"
The parameters (after the ":") are separated by a ">" and are as follows:
1. Staring with Page: 2 is used in cases where the 1
st
title page shouldn’t be numbered.
* specify two numbers separated by || (N||M) to start page numbering on page N with the number
M. For example,
2||1
would start numbering on page 2, but with the number 1.
* specify 3 numbers separated by || (N||M||X) to start page numbering on page N with the number
M, but skip the last X pages. For example,
3||2||1
would start numbering on page 3, with the
number 2, but skip 1 last page.
2. Horizontal page margin
(in millimeters). Doesn’t apply to Centered layouts.
10 is typical.
3. Vertical page margin (in millimeters). 10 is typical.
4. The font size (in points). 11 or 12 are typical.
5. The vertical position on the page (Top or Bottom). Bottom is typical.
6. The horizontal position on the page (Left, Center, or Right). Center is typical.
7. The format (N, Page_N, or Page_NofM ). Page_NofM is typical (e.g., Page 3 of 210).
8. OPTIONAL: The PDF file path & name (for example, c:\temp\other_file.pdf).
Leaving this argument blank, would default to processing the file being exported.
Providing a file name would process the specified file.
9. OPTIONAL: The font type (default is Helvetica).
Possible font types:
Courier, CourierBold, CourierBoldItalic, CourierItalic
Helvetica, HelveticaBold, HelveticaBoldItalic, HelveticaItalic
TimesRoman, TimesBold, TimesItalic, TimesBoldItalic
* or * any TrueType Font specified as 4 elements separated by || like this::
TT||FontName||Style||Red;Green;Blue
TT constant indicating this is a True Type font (target machine should have it installed)
Font Name such as Garamond
Style: Regular, Bold, Italic, or BoldItalic
Color as RGB: 3 numbers between 0 and 255 separated by ";"
Black=0;0;0 Maroon=225;0;0 etc. (see RGB #s at: http://web.njit.edu/~kevin/rgb.txt.html )
For example: TT||Garamond||Bold||225;0;0
44
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 124
Adding Web/File/email Hotspot to a PDF File
You can instruct Visual CUT to add a rectangular hotspot to a pdf file that acts as a web browser
link to a web URL, email address (mailto), or a file on your local machine.
The command line argument structure is as follows:
…
"PDF_LinkToWeb:c:\test.pdf>1>99>40>60>50>10>http://www.MilletSoftware.com>>>0"
The parameters (after the ":") are separated by 10 ">" and are as follows:
1. pdf file to which the hotspot would be added.
2. Staring with Page
3. Ending with Page: use a very large number if you want to apply the hotspot to all pages and
you don’t know how many pages are in the document).
4. Left (in millimeters): The left edge of the hotspot rectangle
(relative to top left corner of the page).
5. Top (in millimeters). The top edge of the hotspot rectangle
(relative to top left corner of the page)
.
6. Width (in millimeters). The width of the hotspot rectangle
7. Height (in millimeters). The height of the hotspot rectangle.
8. Link. for example:
"http://www.MilletSoftware.com"
or
"mailto:ido@MilletSoftware.com"
or
"file:///c:\\temp\\helloworld.bat"
9. Text: the text to add inside the hotspot rectangle (the text font size will be adjusted to
automatically fit the text inside the rectangle area. Leave blank (as demonstrated above) if you
don’t want to add any text.
Do not include the character ‘>’ inside the text.
10. Text Vertical Alignment: Top, Center, or Bottom. Leave blank (as demonstrated above) if
you don’t want to
add any text.
11. Border: 1 for visible border, 0 for no border (default for missing or invalid value is 1)
Notes:
You can have multiple PDF_LinkToWeb command line arguments in a single command line.
You can use field or formula names within the command line argument (just like you drag &
drop fields & formulas into the various options in the 3
rd
tab within Visual CUT. The dynamic
content of these fields/formulas would be substituted into the command line argument. For
example (all in one line):
…
"PDF_LinkToWeb:{@pdf_file}>1>99>40>60>50>10>{@Link}>{@Text}>Center>1"
41
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 125
Adding an Images with an Optional Hotspot to a PDF File
You can instruct Visual CUT to add an image with an optional hotspot (a link to a web page,
email, or a local file. This can be useful when you wish to use a button image as a hotspot
indication or when you wish to add a company logo to a range of pages.
The command line argument structure is as follows:
…
"PDF_AddImage:c:\test.pdf>1>99>40>60>50>10>http://www.IBM.com>c:\temp\IBM.png>0"
The parameters (after the ":") are separated by 10 ">" and are as follows:
1. pdf file to which the hotspot would be added.
2. Staring with Page
3. Ending with Page: use a very large number if you want to apply the hotspot to all pages and
yo
u don’t know how many pages are in the document).
4. Left (in millimeters): The left edge of the hotspot rectangle
(relative to top left corner of the page).
5. Top (in millimeters). The top edge of the hotspot rectangle
(relative to top left corner of the page)
.
6. Width (in millimeters). The width of the hotspot rectangle (image will be resized to fit)
7. Height (in millimeters). The height of the hotspot rectangle (image will be resized to fit)
8. Link. for example:
"http://www.MilletSoftware.com"
or
"mailto:ido@MilletSoftware.com"
or
"
file:///c:\\temp\\helloworld.bat" or "c:/temp/my_media_file.wmf"
Leave blank if you don’t want the image to act as a hotspot.
9. Image File: the path and name of the image file. You can use images of the following types:
BMP, TIFF, JPEG, PNG, GIF, WMF and EMF.
10. Border: 1 for visible border, 0 for no border (default for missing or invalid value is 1)
Notes:
You can have multiple PDF_LinkToWeb command line arguments in a single command line.
You can use field or formula names within the command line argument. The dynamic content of
these fields/formulas would be substituted into the argument. For example (all in one line):
…
"PDF_AddImage:{@pdf_file}>1>99>40>60>50>10>{@Link}>{@Logo}>1"
You can use this site to create .png button images with text of your choice:
http://nyphp.org/content/presentations/GDintro/gd26.php
44
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 126
Adding Links/Images to Files/Pages Using Crystal Formulas as Tags
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 white) and to replace them with links to other
files. Here's an example of the command line argument structure:
…
"PDF_Link_Tags:c:\temp\Sales in {@Year_Parameter}.pdf"
Or
…
"PDF_Link_Tags:Source_pdf_file>target_pdf_file"
If only one pdf file is specified (as in the top example), then the source file becomes also the
target file. The Crystal formulas act as tags for controlling the location, size, border, image, and
behavior of the desired links.
Setting Up a Crystal Report with pdf field tags
You can download a sample report demonstrating the technique from:
www.milletsoftware.com/Download/
Visual_CUT_9_PDF_Link_Tag.rpt
Sample pdf output is at:
www.milletsoftware.com/Download/
Link_Test.pdf
The sample report uses a {@PDF_Link_Tag_Sample} formula to demonstrate a File link to an image file
and a {@PDF_Link_To_Page_N_Plus_1} formula to demonstrate a Page link to another page in the
same document. There are no restrictions on the number or names of the formulas you can use.
The location of the link tag formula on the report layout controls the location of the file links it would
generate. The links would be created for each rendered instance of the formula. For example, if you place
the formula in a Group Footer you will generate a link for each Group.
The location (top left corner) of the rendered formula instances controls the location of the hyperlink in
the pdf file. The width and height of the hyperlink hotspot is controlled by the formula text, not by the
formula field size.
The formula text must be rendered all within the formula boundaries in a single line. Use very
small font sizes: 2 or even 1 to achieve this. Then, turn the font color to White to make the formula
invisible or, if you keep the PDF_Tags_Delete_Default option in DataLink_Viewer.ini as True, Visual
CUT removes the tag text after processing it.
The following page demonstrates (and comments on) the structure of the required formula text.
Notes:
As always, you can use field or formula names within the command line argument. The dynamic
content of these fields/formulas would be substituted into the argument.
The hyperlink hotspot rectangle created by Visual CUT doesn’t provide any text. You can provide the
text within the Crystal report or you can include a directive to fit an image into the hotspot rectangle.
This can provide an intuitive button for the user to click & follow the hyperlink.
You can use the
following site to create .png button images with text of your choice:
http://www.lucazappa.com/brilliantMaker/buttonImage.php
46
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 127
In Crystal, use non-proportional font for the tag formula (avoid Calibri and Bold/Italic).
Avoid Paragraph spacing option of "Exact".
Visual CUT can remove pdf processing tags from the pdf file after processing those tags. This is
controlled by an entry called PDF_Tags_Delete_Default under the [Options] section of
DataLink_Viewer.ini. By default, this option is set to True.
Formula Example from the Sample Report
Here is the
{@PDF_Link_Tag_Sample} formula from the sample report at:
www.milletsoftware.com/Download/
Visual_CUT_9_PDF_Link_Tag.rpt
// Make the font size very small (2 or even 1 point) so that the whole
// content displays within the formula boundaries in a SINGLE line.
// The location (top left corner) of the rendered formula instances
// control the location of the link.
// link to pdf file in same folder: "file name"
// link to non-pdf file in same folder: ".file name"
// link to non-pdf file in 1-level higher folder: "..file name"
// The formula always starts with "#Link_Tag::" and ends with "#"
"#Link_Tag::" +
"PDF" + "||" + // Link Type: "PDF" for links to a page in another pdf file.
// "Page" for links to a page in same pdf file
// "File" for links to other file types.
// "MAIL" for mailto.
// "HTTP" for web link.
// "" (blank) for other types of links (e.g. Tel:)
{Product.Product Name} + ".pdf" + "||" + // The file to link to. Blank if Link Type = "Page"
"" + "||" + // [optional] file to test it exists, and abort otherwise.
"1" + "||" + // page destination in target file (ignored if not pdf). Zoom is inherited.
// to specify both PageN & Zoom,
// use a "
;
" separator: "1;100" (page 1, zoom 100%)
// -1 zoom value = Fit Page
// -2 zoom value = Fit Width
"70;20" + "||" + // hot spot boundaries in points: width;height
// (note: if 4 arguments are provided,
// they are treated as: shift_x;shift_y;width;height)
"1" + "||" + // New Window Option. 1: opens target pdf file in a new Window
// 0: opens target in current window)
"0" + "||" + // Border Option: 1: Show Border. 0: No border
"c:\temp\Click_to_View.png" + // [optional] path & name of Image File to fit
// You can use images of the following types:
// BMP, TIFF, JPEG, PNG, GIF, WMF and EMF.
"#"
29
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 128
Embedding Files as Attachments inside a PDF File
Note: in most cases, you should skip this page. The following section describes a more powerful
technique that not only embeds files, but also provides links to them.
Using a command line argument, you can instruct Visual CUT to embed files as internal
attachments inside a given pdf file. The command line argument structure is as follows:
…
"PDF_Embed:PDF_File<<file1::Mime Type::title||file2
::Mime Type::title…
"
The parameters (after the ":") begin with
1. PDF_File: The PDF file within which you wish to embed files.
Then, after a "<<" separator, you can specify any number of embedded files separated by "||"
Each embedded file is specified as 3 arguments separated by "::"
1. File Path and Name
Note: If a path is not specified, the path from a previous embedded file is used
2. The MIME Type of the file. For example, application/pdf or image/jpg , etc.
see http://www.w3schools.com/media/media_mimeref.asp for a list of MIME types
If you leave blank, Visual CUT would detect the MIME type based on file extension.
3. The Title to uniquely identify the embedded file.
For example:
"PDF_Embed:c:\temp\test.pdf<<c:\temp\INV.pdf::application/pdf::Invoice||Sig.jpg::image/jpg::Signature"
Important Note: you can use field or formula names within the command line argument (just like
you drag & drop fields & formulas into the various options in the 3
rd
tab within Visual CUT).
The dynamic content of these fields/formulas would be substituted into the command line
argument.
43
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 129
Adding Links and Embedded Files Using Crystal Formulas as Tags
A command line argument can instruct Visual CUT to look for tags inside the pdf file (text from
Crystal formulas). When a Link_Tag with EMBED directive is found, the file specified in the tag
is embedded inside the pdf file and a hotspot area designated with an icon, in the location of the
tag, is created to link to that embedded file. Any file can be embedded, and embedded pdf files
can have their own embedded files, which supports multi-level drill-down scenarios. See video
demo:
www.milletsoftware.com/Download/Visual_CUT_PDF_Embed/Visual_CUT_PDF_Embed.html
This allows you to deliver a PDF with drill-down or added content that the user can bring
up by double-clicking a link. This is like on-demand subreports, except that:
1. the content has been pre-rendered
2. the subreports can contain their own subreports
3. the embedded files can be any file type (pdf, excel, Word, image, audio, video ...)
4. the container pdf can be password protected and/or digitally signed by Visual CUT
If the embedded file is a pdf file, PDF Xchange Viewer opens it as new tab inside the main pdf.
Other viewers, such as Acrobat Reader 9 open the embedded pdf in a new viewer window.
Here's an example of the command line argument structure:
…
"PDF_Link_Tags2:c:\temp\Sales in {@Year_Parameter}.pdf"
Or
…
"PDF_Link_Tags2:Source_pdf_file>target_pdf_file"
If only one pdf file is specified the source file becomes also the target file.
Setting Up a Crystal Report with Link_Tag Formulas
You can download a sample report demonstrating the technique from:
www.milletsoftware.com/Download/
Visual_CUT_PDF_Link_Tag_File_Embed.rpt
Sample pdf output is at:
www.milletsoftware.com/Download/
Visual_CUT_PDF_Embedded_Drill_Down_Sample.pdf
The sample report uses a {@PDF_Link_Tag_1} formula in Group Header 1 to demonstrate a file
embedding link. There are no restrictions on the number or names of the formulas you can use.
The location of the link tag formula on the report layout controls the location of the hotspot and link icon
it create for each rendered instance of the formula. The top left corner of the rendered formula instance
controls the location of the hyperlink in the pdf file. The width and height of the hyperlink hotspot is
controlled by the formula text, not by the formula field size.
The formula text must be rendered all within the formula boundaries in a single line. Use very
small font sizes: 2 or even 1 to achieve this. Then, turn the font color to White to make the formula
invisible or, if you keep the PDF_Tags_Delete_Default option in DataLink_Viewer.ini as True, Visual
CUT removes the tag text after processing it.
The following page demonstrates (and comments on) the structure of the required formula text.
41
©2002-2016, Ido Millet, ido@MilletSoftware.com
Page 130
As always, you can use field or formula names within the command line argument. The dynamic
content of these fields/formulas would be substituted into the argument.
Visual CUT can remove pdf processing tags from the pdf file after processing those tags. This is
controlled by an entry called PDF_Tags_Delete_Default under the [Options] section of
DataLink_Viewer.ini. By default, this option is set to True.
Formula Example from the Sample Report
Here is the
{@PDF_Link_Tag_Sample} formula from the sample report at:
www.milletsoftware.com/Download/
Visual_CUT_PDF_Link_Tag_File_Embed.rpt
// Make the font size very small (2 or even 1 point) so that the whole
// content displays within the formula boundaries in a SINGLE line.
// The location (top left corner) of the rendered formula controls the location of the link.
// The formula always starts with "#Link_Tag::" and ends with "#"
"#Link_Tag::" +
"Embed" + "||" + // Link Type. Use lower case "embed" to ignore (skip) missing files
"c:\temp\Sales for " + {Product_Type.Product Type Name} + ".pdf" + "||" + // The file to embed
"" + "||" + // MIME Type of the file to embed. Leave blank for automatic identification
"Double-Click to See" + "||" +
// Hotspot Tooltip Header Line
"Detail for " + {Product_Type.Product Type Name} + "||" + // link description (tooltip 2
nd
line)
"18;18" + "||" + // hot spot boundaries in points: width;height
// (4 arguments instead of 2 are treated as: shift_x; shift_y; width; height)
"0" + "||" + // Icon Option for the link:
// 0 = Standard Icon (push-pin)
// 1 = 28x28 disk image
// 2 = No icon
// 3 = Graph
// 4 = Paperclip
// 5 = Tag
// 6 = Solid white rectangle
// You may add 1000 to 1100 for transparency of 0% to 100%
// the last digit indicates the icon. 1074 = 70% transparent Paperclip
"" +
// [optional] Image File to fit as background e.g. c:\temp\file.png
//supported types: BMP, TIFF, JPEG, PNG, GIF, WMF and EMF.
"#"
Documents you may be interested
Documents you may be interested