Hi.
I'm trying to print the contents of a canvas, using the postscript method. However, whenever I print, all I get is an empty page. When I write the Postscript output to a file and view it, it too is blank.
Here's the code:
-----START CODE-----
canvas .thecanvas
label .thecanvas.thelabel -text "moo asdf qwert test\nqq uuiioopp\naassddffgg\nhhjjkkll\nzzxxccvv bbnnmm"
pack .thecanvas.thelabel -in .thecanvas
pack .thecanvas
set x0 0
set y0 0
set x1 [winfo width .thecanvas]
set y1 [winfo height .thecanvas]
foreach {x0 y0 x1 y1} [.thecanvas bbox all] {}
set w [expr $x1 - $x0]
set h [expr $y1 - $y0]
set ps [.thecanvas postscript -x $x0 -y $y0 -width $w -height $h]
#exec lpr -d$printer << [.thecanvas postscript -x $x0 -y $y0 -width $w -height $h]
set moo [open "~/test.ps" w]
puts -nonewline $moo $ps
puts "x: $x0, y: $y0, w: $w, h: $h"
-----END CODE-----
For some reason, the width and the height (w and h) are both 1 in this program. In my full program, they are 815 and 1180, though that also prints a blank page.
I'm trying to print the contents of a canvas, using the postscript method. However, whenever I print, all I get is an empty page. When I write the Postscript output to a file and view it, it too is blank.
Here's the code:
-----START CODE-----
canvas .thecanvas
label .thecanvas.thelabel -text "moo asdf qwert test\nqq uuiioopp\naassddffgg\nhhjjkkll\nzzxxccvv bbnnmm"
pack .thecanvas.thelabel -in .thecanvas
pack .thecanvas
set x0 0
set y0 0
set x1 [winfo width .thecanvas]
set y1 [winfo height .thecanvas]
foreach {x0 y0 x1 y1} [.thecanvas bbox all] {}
set w [expr $x1 - $x0]
set h [expr $y1 - $y0]
set ps [.thecanvas postscript -x $x0 -y $y0 -width $w -height $h]
#exec lpr -d$printer << [.thecanvas postscript -x $x0 -y $y0 -width $w -height $h]
set moo [open "~/test.ps" w]
puts -nonewline $moo $ps
puts "x: $x0, y: $y0, w: $w, h: $h"
-----END CODE-----
For some reason, the width and the height (w and h) are both 1 in this program. In my full program, they are 815 and 1180, though that also prints a blank page.