Re: How to export postscript from canvas?
- From: George Petasis <petasis@xxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 16:10:29 +0300
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
- References:
- How to export postscript from canvas?
- From: George Petasis
- How to export postscript from canvas?
- Prev by Date: Re: How to control the loop within expect.
- Next by Date: Using foreach loop to create radiobutton menu
- Previous by thread: How to export postscript from canvas?
- Next by thread: How to control the loop within expect.
- Index(es):