[REBOL] Re: pdf-maker.r
From: brett:codeconscious at: 19-Apr-2002 23:17
Hi Louis,
> Here is how I am using pdf-maker.r to print out my reports (I would
> appreciate any advice on how this can be improved):
Your code is constructing REBOL script inside a script which the people
at RT find aesthetically disturbing :^) You do not need to do this.
This is also the reason for those two replacement lines.
Constructing blocks of REBOL script can be just as easy or easier than
contructing strings. In this case is it much simpler.
I have changed your code to construct a block that represents a page in
the pdf-maker dialect. Then I add the page block to the document block.
Finally the pdf-layout function is applied to the document block.
This has the nice side effect that when reading the new program you can
see the page relatively clearly. More importantly I think it is easier
to modify.
REBOL []
do %pdf-maker.r
if exists? %pig.pdf [delete %pig.pdf]
count: 0
lets: copy [{AAAAAAAAA} {BBBBBBB} {CCCCCC}]
pdf-document: copy []
foreach let lets [
page: compose/deep [
textbox [font Courier 4.4 as-is (:let)]
]
append/only pdf-document page
count: count + 1
]
write/binary %pig.pdf layout-pdf pdf-document
browse %pig.pdf
ask "Continue? "
delete %pig.pdf
I hope that this helps you get some sleep :^)
Brett.