World: r3wp
[Postscript] Emitting Postscript from REBOL
older newer | first last |
Henrik 7-Apr-2006 [270x3] | http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=ean13.r <--- did this one a year ago. it uses PDF maker to generate barcodes |
it can also generate bitmapped barcodes. works only with EAN13 format though | |
hmm... seems I forgot to upload the version that actually can use PDF Maker :-) | |
Geomol 7-Apr-2006 [273x2] | New version! Try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r print postscript [page [path [linewidth 10 at 72x72 box 72 72]]] |
I only test it on the screen under MacOS, where there is an automatic converter. Can someone test it on a PS printer? | |
Henrik 7-Apr-2006 [275x2] | how do you convert it? I can't make preview.app read it |
ah, problem fixed | |
Geomol 7-Apr-2006 [277x3] | I do: write %test.ps postscript [page [path [linewidth 10 at 72x72 box 72 72]]] and then open test.ps with Finder. |
ok :) | |
Maybe box shouldn't be inside a path block, but be an instance of itself? | |
Henrik 7-Apr-2006 [280] | I have no idea... |
Geomol 7-Apr-2006 [281] | What is best? page [path [at 72 72 box 100 100]] or page [box 72 72 100 100] |
Henrik 7-Apr-2006 [282] | the first one is most readable |
Geomol 7-Apr-2006 [283] | Try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [linewidth 5 path [setgray 0.5 at 72.5 72 boxfill 72 72]]] |
Henrik 7-Apr-2006 [284] | wonderful! |
Geomol 7-Apr-2006 [285] | I guess, linewidth mean nothing in that example and can be left out. Sorry about that! |
Henrik 7-Apr-2006 [286] | I wonder if it's possible to flip the coordinate system to match that of DRAW |
Geomol 7-Apr-2006 [287] | I read something about that... |
Graham 7-Apr-2006 [288x4] | draw starts 0x0 at bottom left ? |
you can write postscript functions that translate from one coordinate to another. | |
PostScript normally uses units of "points" for placing graphics on the page. I find it more convenient to work with centimeters. I got the following snippet of PostScript code from a public domain program called "GLE" which I believe is available at any large ftp site; I recommend this graphics program. By examining the PostScript output of that program I collected the following piece of PostScript code: matrix currentmatrix /originmat exch def /umatrix {originmat matrix concatmatrix setmatrix} def [28.3465 0 0 28.3465 10.5 100.0] umatrix What this basically does is rescale the page so that now all following commands will work as if the centimeter is the basic unit of length. This places (0,0) near the bottom left of the page and (21,24) near the top right of the page. If you don't do this, then (0,0) is the bottom left corner of the page and (612,792) is the top right corner of the page (if you are using an 8 1/2 inch by 11 inch sheet of paper). These are the default PostScript units; 72 of these to an inch. 28.3465 to a centimeter, thus the numbers above in the last line of PostScript code. | |
taken from http://www.physics.emory.edu/~weeks/graphics/howtops1.html | |
Henrik 7-Apr-2006 [292] | it does? |
Graham 7-Apr-2006 [293x2] | John, what version is that script ? I see 0.1.1 |
I think my isp heavily caches so I can't see new stuff. | |
Geomol 7-Apr-2006 [295x5] | version 0.2.0 now. Refresh! |
New version with cm! do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [setcm linewidth 20 path [setgray 0.5 at 2.5 2 boxfill 8 12]]] | |
setcm seems to influence font size. Try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [font [Times-Roman 1] setcm linewidth 0.5 path [setgray 0.5 at 2.5 2 box 8 12] path [at 5x8 rotate 45 "Hello World!"]]] | |
AT can both be specified as a pair and 2 numbers. | |
I can't find the switch y-axis thing right now. Maybe a matrix is needed? | |
Graham 7-Apr-2006 [300] | well, my postscript printer printed out a gray box! |
Geomol 7-Apr-2006 [301x3] | Wow! :) |
We're not all lost then! ;-) | |
Good news. :) | |
Graham 7-Apr-2006 [304] | You should really put the %!PS header in. |
Geomol 7-Apr-2006 [305x2] | Comments come last. |
% mean comment. | |
Graham 7-Apr-2006 [307x2] | I know. It tells the printer what is coming. |
whether it's postscript, pdf or whatever. | |
Geomol 7-Apr-2006 [309] | ahh, then I'll put it in now. Just: %!PS ? |
Graham 7-Apr-2006 [310x2] | sure. |
%!PS-Adobe-3.0 %%Creator: postscript.r ver 0.2.0 | |
Geomol 7-Apr-2006 [312] | done |
Henrik 7-Apr-2006 [313] | so both "at 3x3" and "at 3 3" can be used? |
Geomol 7-Apr-2006 [314x3] | yes |
New version with line, try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [linewidth 5 path [setgray 0.8 line 72x72 100x72 102.5 87.3 200x115]]] | |
again coords can be a pair or 2 numbers, also decimals. | |
Henrik 7-Apr-2006 [317] | setcm doesn't seem to work here... |
Geomol 7-Apr-2006 [318x2] | When setcm is used, max coords is 20 or so to be within page. |
21x24 | |
older newer | first last |