Version 1 of BLT - graph - printing postscript

Updated 2003-10-08 22:23:07

Printing postscript from the BLT graph widget is pretty easy, much like you can print from canvas widgets. The postscript options are described pretty well in the HTML documentation.

  .g postscript configure -landscape yes -maxpect yes
  .g postscript output myFile.ps

There's another approach you can try. There's an "eps" canvas item in BLT. An "eps" item displays a Tk image that represents some encapsulated PostScript code. You can arbitrarily resize and position the eps item on the canvas. The image is also resized and repositioned.

    canvas .c -width 6.75i -height 5.25i -bg white
    pack .c

    .c create eps 10 620 -file xy.ps -width 470 -height 400 -anchor sw
    .c create eps 500 10 -file g1.ps -width 300 -height 300 -anchor nw
    .c create eps 500 320 -file out.ps -width 300 -height 300 

    .c create text 20 200 \
        -text "This is a text item" \
        -fill black \
        -anchor w \
        -font { Helvetica 24 bold }
    .c create rectangle 10 10 50 50 -fill blue -outline white
    .c create rectangle 50 50 150 150 -fill green -outline red

But when you print the canvas (i.e. generate PostScript), instead of the image, the encapsulated PostScript is used. The embedded EPS is scaled and translated accordingly. And since the PostScript is transformed, the resolution is much better (device independent). You can still use other canvas item for annotations, company logos, etc. In short, your canvas code is your page description. It's easy to tile graphs and mark them up.


There are different, less well documented approaches to printing under Windows at BLT - graph - printing from Windows


Category BLT