hello.tcl

来自「windows下PDF文档的开发包」· TCL 代码 · 共 46 行

TCL
46
字号
#!/bin/sh
# $Id: hello.tcl,v 1.15.2.2 2003/09/04 12:47:53 tm Exp $
#
# PDFlib client: hello example in Tcl
#

# Hide the exec to Tcl but not to the shell by appending a backslash\
exec tclsh "$0" ${1+"$@"}

# The lappend line is unnecessary if PDFlib has been installed
# in the Tcl package directory
set auto_path [linsert $auto_path 0 .libs .]

package require pdflib 5.0

# create a new PDFlib object
set p [PDF_new]

# open new PDF file
if {[PDF_open_file $p "hello.pdf"] == -1} {
    puts stderr "Error:  [PDF_get_errmsg $p]"
    exit
}

PDF_set_info $p "Creator" "hello.tcl"
PDF_set_info $p "Author" "Thomas Merz"
PDF_set_info $p "Title" "Hello world (Tcl)"

# start a new page
PDF_begin_page $p 595 842

set font [PDF_load_font $p "Helvetica-Bold" "winansi" ""]

PDF_setfont $p $font 24.0
PDF_set_text_pos $p 50 700
PDF_show $p "Hello world!"
PDF_continue_text $p "(says Tcl)"
# close page
PDF_end_page $p

# close PDF document
PDF_close $p

# delete the PDFlib object
PDF_delete $p

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?