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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Graham
13-Apr-2006
[499]
you can't use a postscript barcode font?
Henrik
13-Apr-2006
[500]
no, the barcode is already working fine. it's the position of the 
image on the paper and general arrangement of the code that needs 
to be worked out
Graham
13-Apr-2006
[501]
oh well, good luck.
Henrik
13-Apr-2006
[502]
thanks
Graham
13-Apr-2006
[503]
oh, how are you doing the image in postscript ?
Henrik
13-Apr-2006
[504]
just drawing lots of parallel lines
Graham
13-Apr-2006
[505]
ok, there's a hex format for images as well as using eps, but I don't 
know how that works.
Henrik
13-Apr-2006
[506x2]
interesting
like image! ?
Graham
13-Apr-2006
[508]
guess so.
Henrik
13-Apr-2006
[509x2]
ok I can rotate, but not translate
ah! I was using a pair! instead of two numbers
Graham
13-Apr-2006
[511x2]
Thinking of what John said, I suspect if you try and automate the 
newpath etc, you'll get into problems.
You'll be trying to write a better postscript than postscript .. 
.which may be possible!
Henrik
13-Apr-2006
[513x2]
I haven't been thinking of that yet.... but the ultimate goal should 
be to use postscript on a higher level
postscript [page [at 20x20 barcode 12345]]
Graham
13-Apr-2006
[515x2]
at least we gain by .. losing the rpn notation, and also using pairs 
instead of two numbers.
A higher level is that .. writing a better poscript.
Henrik
13-Apr-2006
[517]
well, is C a better assembler?
Graham
13-Apr-2006
[518]
it's slower :)
Henrik
13-Apr-2006
[519x2]
there we go... http://www.hmkdesign.dk/barcode.ps
now to redesign the API. it's too clunky right now
Graham
13-Apr-2006
[521x2]
that looks pretty neat!
I take it that was much harder to do in pdf-maker.r ??
Henrik
13-Apr-2006
[523x2]
it's a bit harder but not much different
actually only the text was harder because in PS you point to a position 
and start writing, where you in PDF-maker need to define a text box 
before writing
Graham
13-Apr-2006
[525]
Is this EAN ?
Henrik
13-Apr-2006
[526x2]
EAN13
works fine with barcode readers. have tested with both cheap and 
expensive ones. just need a good printer
Graham
13-Apr-2006
[528]
where's the barcode function?
Henrik
13-Apr-2006
[529x2]
http://www.hmkdesign.dk/rebol/barcode/ean13.r
do %postscript.r
do %ean13.r
ean13-ps ean13-create "123456789012" ; 12-digit code

will output a block to be inserted in the postscript block
Graham
13-Apr-2006
[531]
Ok, not trivial !
Henrik
13-Apr-2006
[532]
a bit clunky
Graham
13-Apr-2006
[533]
Luckily I have no need for a barcode at present.
Henrik
13-Apr-2006
[534x2]
the string is necessary, but I should probably put the create function 
inside the barcode generator function
you can take any 12 digit string, but the 13th digit is a checksum 
which must be correct or the barcode can't be read
Graham
13-Apr-2006
[536]
http://www.compkarori.com/reb/test2.pdf
Henrik
13-Apr-2006
[537]
neat
Graham
13-Apr-2006
[538]
make-circles: func [ count /local out ][
	out: copy []
	loop count [

  repend out [ 'newpath 'circle to-pair reduce [ random 700 random 
  700 ] random 40 
			'color 
			to-tuple rejoin [ random 255 "." random 255 "." random 255 ]
			'fill
		] 
	]
	out
]

test5: form ps/header compose [
	gsave
	(make-circles 500)
	grestore
	showpage
]
Henrik
13-Apr-2006
[539x2]
I think it's bedtime... can hardly see the code anymore
night
Graham
13-Apr-2006
[541x8]
borrow some matchsticks to keep the eyelids open!
night
this is a multipage postscript file
ps/header [
	newpage "Title"
	at 72x72 font Times-Roman 12 "page 1"
	showpage
	newpage "Body"
	at 144x144 "page 2"
	showpage
]
and produces this postscript output
%!PS-Adobe-3.0 
%%Creator: ps.r ver 0.0.6 
%%Pages: (atend) 
%%EndComments 
%%Page: Title 1 
72 72 moveto /Times-Roman findfont 
12 scalefont 
setfont 
(page 1) show 
showpage 
%%Page: Body 2 
144 144 moveto (page 2) show 
showpage 

%%Trailer 
%%Pages: 2 
%%EOF
http://www.compkarori.com/reb/starburst.pdfis a starburst
http://www.compkarori.com/reb/clipped.pdfare the words "REBOL Rulz" 
clipped to the starburst.