tags:

views:

31

answers:

1

I'd like to create a printable output file from within Squeak, for instance to create a report.

I've done a little Googling and I'm surprised by how little material in the way of examples relating to creating printable files exist. However, I've found a couple of classes class called PostscriptCanvas and EPSCanvas and a method within it called morphAsPostscript.

To try these classes out I created a tiny code example and my first workspace example was:

p := PasteUpMorph new.
p extent: 300@300.
p position: 20@20.
p borderColor: Color black.
p setProperty:  #cornerStyle toValue: #rounded.
p openInWorld.
(FileStream newFileNamed: 'test1.ps') nextPutAll: (PostscriptCanvas morphAsPostscript: p)

unfortunately the above doesn't work and halts with doesnotUnderstand #pageBBox.

when I try the example again but this time using the EPSCanvas class:

p := PasteUpMorph new.
p extent: 300@300.
p position: 20@20.
p borderColor: Color black.
p setProperty:  #cornerStyle toValue: #rounded.
p openInWorld.
(FileStream newFileNamed: 'test2.eps') nextPutAll: (EPSCanvas morphAsPostscript: p).

this time I generate output but the corners of the box aren't rounded in the eps file (they are rounded on the screen).

So, my questions are:

  1. Am I on the right track as far as generating printable output or should I be using an alternative technique?
  2. Why does the first example crash with doesnotUnderstand #pageBBox?
  3. Why does the second example almost work but does not render the rounded corners?

Thanks Kevin

+2  A: 

It's not just Squeak - producing printable output is fearsomely difficult in any programming language. Whenever I've done project planning and people mention reports, I immediatel double (at least) the project estimates. Personally, I would recommend writing the data to a file in some well-known format such as XML or CSV and then use a report-writing package to produce the actual reports.

Sorry not to be more helpful!

anon