Re: How to export postscript from canvas?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: How to export postscript from canvas?

From: George Petasis <petasis@iit.demokritos.gr>
Date: Fri Apr 28 2006 - 15:10:29 CEST

I can't find out what I am doing wrong, but using the
canvasprintbox drom IWidgets seems to always do the postscript export
fine. Its a pity I have to curry Itk/Iwidgets for this simple task
though :-)

George

O/H George Petasis έγραψε:
> Hi all,
>
> It may seem a trivial question, but I really don't know how
> to export postscript from a canvas correctly. I am using
> the postscript canvas command to write the postscript to a
> file, but there are many situations that the generated
> postscript does not contain the whole canvas.
>
> For the time being, my code for exporting is:
>
> foreach {x1 y1 x2 y2} [$canvas bbox all] {break}
> set width [expr {$x2-$x1+50}]
> set height [expr {$y2-$y1+50}]
> $canvas move all [expr {0.0-$x1}] [expr {0.0-$y1}]
> $canvas postscript -file $filename -rotate 1 -x -50 -y -50 \
> -pagewidth 297m -pageheight 210m \
> -width $width -height $height
> $canvas move all $x1 $y1
>
> This works somewhat well, but it fails on large canvas
> bounding boxes, especially if they have a portrait orientation.
> In such cases, the diagram is simply cropped, and only its center
> portion is visible. How can I scale the drawing, so as to always
> contain all canvas items? Also, even if I move all the items
> to have coordinates greater than 0.0, why the bounding box
> has negative numbers?
>
> Al these may seem silly, but usually the generated postscript
> from Tk gets cropped when viewed from ghostview...
>
> Right now the only way I have found that always works, is to export
> canvas items to SVG, and use inkscape to convert it into .ps (not
> .eps, as this also doesn't work :-) ). I am looking for a more direct
> approach :-)
>
> George
Received on Sun Apr 30 03:30:33 2006