home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / bind / tcl / hello.tcl next >
Encoding:
Text File  |  2001-07-04  |  848 b   |  39 lines  |  [TEXT/WIsH]

  1. #!/bin/sh
  2. # $Id: hello.tcl,v 1.9 2001/03/15 13:42:54 rjs Exp $
  3. #
  4. # PDFlib client: hello example in Tcl
  5. #
  6.  
  7. # Hide the exec to Tcl but not to the shell by appending a backslash\
  8. exec tclsh "$0" ${1+"$@"}
  9.  
  10. # The lappend line is unnecessary if PDFlib has been installed
  11. # in the Tcl package directory
  12. set auto_path [linsert $auto_path 0 .libs .]
  13.  
  14. package require pdflib 4.0
  15.  
  16. set p [PDF_new]
  17.  
  18. if {[PDF_open_file $p "hello.pdf"] == -1} {
  19.     puts stderr "Couldn't open PDF file!"
  20.     exit
  21. }
  22.  
  23. PDF_set_info $p "Creator" "hello.tcl"
  24. PDF_set_info $p "Author" "Thomas Merz"
  25. PDF_set_info $p "Title" "Hello world (Tcl)"
  26.  
  27. PDF_begin_page $p 595 842
  28. set font [PDF_findfont $p "Helvetica-Bold" "host" 0 ]
  29.  
  30. PDF_setfont $p $font 18.0
  31.  
  32. PDF_set_text_pos $p 50 700
  33. PDF_show $p "Hello world!"
  34. PDF_continue_text $p "(says Tcl)"
  35. PDF_end_page $p
  36. PDF_close $p
  37.  
  38. PDF_delete $p
  39.