r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Postscript] Emitting Postscript from REBOL

james_nak
6-Apr-2006
[87]
I thought about this subject yesterday night and yeah, it would be 
nice to be able to do "anything and everything" in Rebol and PS does 
offer that. Besides the kind of charts that Graham showed, things 
like wrapping/flowing text around graphic images would be useful. 
Of course at some point I would most likely convert it to pdf through 
Distiller. 

I totally agree that good clean output is essential. My last programming 
foray in PS was some 16 years ago. At that time it was the only way 
to go for me. I suppose that alone shows the staying power of PS.
Graham
6-Apr-2006
[88x2]
Gregg, it's like cgi... unless you've got a web server, cgi is a 
waste of time for you.  If I have a web service that uses a postscript 
dialect to create a postscript image, and then uses ghostscript to 
convert to pdf .. well, that is useful to those running web services, 
but a waste of time for those who don't.
That's why we call them domain specific languages .. they're not 
for everyone, right!
Gregg
6-Apr-2006
[90]
Yup.
Henrik
6-Apr-2006
[91]
pekr, reading your comments seem to focus on a PS viewer. This is 
completely uninteresting to me. I want tools that are native to REBOL 
to allow me to print graphics directly to a printer with the fewest 
amount of 3rd party tools. How many shrinkwrapped apps out there 
need third party tools for something as basic as printing?
Graham
6-Apr-2006
[92]
I've got a colour laser printer on my network which I think supports 
postscript.  I presume to print a postscript file, I just send it 
to the ip address of the printer?
Maxim
6-Apr-2006
[93]
hum  good question.  I'd like to know this as well... anyone?
Graham
6-Apr-2006
[94x4]
I have a jetdirect usb print server at 192.168.1.253

>> port: open/direct tcp://192.168.1.253:9100
>> insert port read %boys-0-36-length-weight.ps
>> close port
and I printed out my postscript file with no problems.
jetdirect print servers use 9100 for data, and 80 for the embedded 
webserver.
That was pretty easy ... create the postscript  file, and send it 
directly to the printer, or print server.
Henrik
6-Apr-2006
[98]
precisely
Graham
6-Apr-2006
[99x3]
I wonder if we should use an existing dialect and modify it to product 
ps .. or create one from scratch.
Should we use pair! or not ?
moveto 72x72, or moveto 72 72 
postscript is RPN, so that looks like 72 72 moveto
Henrik
6-Apr-2006
[102]
what about starting from the DRAW dialect?
Graham
6-Apr-2006
[103]
I guess if the main aim is to take drawings to postscript, then that 
makes sense.
Henrik
6-Apr-2006
[104]
the fastest route definitely. a PS -> DRAW thing would be a nice 
thing to have but DRAW -> PS is the most important right now
Graham
6-Apr-2006
[105x2]
So, for example, if we used to plot dialect to draw a graph, we can 
then emit postscript and send directly to the printer.
used the Plot dialect ..
Henrik
6-Apr-2006
[107]
yes, I think it should work like the DRAW function, but instead of 
producing an image it produces a string! value to be used however 
you want it
Graham
6-Apr-2006
[108x3]
String! is good.
Or, perhap a block! for further processing?
Say you wanted to insert an eps file into your output.
Henrik
6-Apr-2006
[111]
not sure about the mechanism yet, but maybe yes
Graham
6-Apr-2006
[112]
An eps file is just a postscript file which is written in a special 
way ...
Henrik
6-Apr-2006
[113]
there is no paper information AFAIK
Graham
6-Apr-2006
[114x2]
In the name of science, I repeated the above test and it printed 
out again.
I also tried it with a pdf, as the printer supports direct pdf printing, 
but nothing happened.
Henrik
6-Apr-2006
[116]
interesting. tried different pdfs?
Graham
6-Apr-2006
[117]
Not yet.
Geomol
7-Apr-2006
[118x4]
DRAW -> PS is one possibility. Should we on a longer term also have 
a dialect or set of functions, than can produce PS?
that
DRAW is also a function used like:
img: make image! 100x100
DRAW img <some draw commands>

With PostScript, I'm thinking something like:
ps-output: ""
POSTSCRIPT ps-output <some PS commands>


ps-output could then also be a file! or port! and send the output 
directly to the destination.
<some PS commands> in the above is a block of commands with arguments.
Graham
7-Apr-2006
[122]
Is the aim to take a draw block and process it so that postscript 
is produced.
Geomol
7-Apr-2006
[123x2]
That's what I understood from Henrik's posts.
It's one way of doing it, and maybe not so bad. I don't know enough 
about PS to see, if DRAW is too limited. Maybe PS has a lot other 
stuff, you wanna do, that is difficult to do in DRAW.
Graham
7-Apr-2006
[125x2]
as far as I recall, it has quite a limited command set.
of course, you can define new functions within ps.
Geomol
7-Apr-2006
[127x2]
The DRAW approach is, that if you can produce your output in a DRAW 
block, then you can also print it using PS. My approach is to make 
a PS dialect, and keep DRAW out of is. With my approach, you can 
print from REBOL/Core too. I guess, we can have both approaches without 
problem.
And both will be usefull for different situations.
Graham
7-Apr-2006
[129]
but using a draw dialect is possible in core .. u just can't render 
it.
Geomol
7-Apr-2006
[130]
Oh, you're right. :-)
Graham
7-Apr-2006
[131x2]
but let's start with a postscript dialect and then see if we can 
retrofit draw to it.
that way we are not constrained by draw.
Geomol
7-Apr-2006
[133]
Then I just need a list of PS commands to get started on the dialect.
Graham
7-Apr-2006
[134x3]
since rebol3 is coming, and View may well change, it makes less sense 
to stick to the past.
this has a reference at the end : http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html
Is this works, you can then render your paint images to postscript 
printers :)