Version 12, last updated by Krzysztof Blicharski at March 24, 2009 15:41 UTC
USER GUIDE
What you need to run this package
How to install
How to use
What you need to run this package?
* Tcl >= 8.4 (it uses dictionaries)
* Tk
* nothing more, tktopdf is pure tcl package.
How to install
Tktopdf is very simple package, you can install it in sevreal ways.
1) By including source file
You can simply include source files by adding these lines to your source file:
source pdf.tcl
source transformations.tcl
source tktocanvas.tcl
source tktopdf.tcl
2) By setting up auto_path variable
If you have your application and tktopdf in the same directory, you only need put these lines into your application:
set dir [pwd]
set ::auto_path "$::auto_path $dir"
package require tktopdf
3) By putting tktopdf into your packages directory.
In this case you will only need to add one line to your application:
package require tktopdf
How to use
To export a window, you need to do three steps:
1) first, you must pinpoint a pdf file name, and it's parameters. To do this you must use
tktopdf::startFile command, it's arguments are:
| -file | Name of pdf file which will be created. |
| ?-scalex? | X scale factor (range from 0.1 to n.0) |
| ?-scaley? | Y scale factor (range from 0.1 to n.0) |
| ?-marginleft? | Size of left margin. * |
| ?-marginright? | Size of right margin. * |
| ?-margintop? | Size of top margin. * |
| ?-marginbottom? |
Size of bottom margin. * |
| ?-pagex? | X offset where the printed area appears in pdf file. |
| ?-pagey? |
Y offset where the printed area appears in pdf file. |
| ?-rotatexy? |
Rotation factor (one of 0, 90, 180, 270 (measured in degress)). |
| ?-pagewidth? | A width of pdf file page. |
| ?-pageheight? | A height of pdf file page. |
| * The size may be in centimeters, points, milimeters and pixels. Default:pixels |
2) Next you must pinpoint which window you want to export:
tktopdf::exportWindow $windowName
2a) If you want to export more than one window you may use
tktopdf::nextPage
command, and then you must again call tktopdf::exportWindow with window's name you want to export
3) In the end, you must simply call
tktopdf::endFile
command, to acomplish whole process.
And now, if everything goes fine, you should get pdf file with exported window(s).
Sample use:
tktopdf::startFile -file "__test.pdf" \
-scalex 1.0 -scaley 1.0 \
-marginleft 0.25i -margintop 0.25i -marginright 0.25i -marginbottom 0.25i \
-pagex 0 -pagey 0 \
-rotatexy 0 -pagewidth 800 -pageheight 600
tktopdf::exportWindow .
tktopdf::endFile