[REBOL] Re: pdf-maker.r
From: brett:codeconscious at: 20-Apr-2002 0:11
Hi Louis,
Here is another idea. I remember you were doing some receipts so this could
be useful.
I construct an object caled ctx-letter.
Then I bind the page-template block to ctx-letter. What this means is
that any words that are found in page-template that are also in
ctx-letter take on the value given in ctx-letter.
The rest of it is pretty much like my last post.
page-template looks a bit complex but it is not. The stuff in the between
the ( and ) will eventually just return a single
string when compose has finished its work.
REBOL []
do %pdf-maker.r
letters: [
[to: "Louis" blurb: {I hope it helps!}]
[to: "Gabrielle" blurb: {Thanks for pdf-maker!}]
[to: "The Gang" blurb: {This has been most enlightening!}]
]
page-template: [
textbox [
font Courier 4.4 as-is (
rejoin [
"To: " to newline
"Date: " now/date newline
newline
blurb
]
)
]
]
if exists? %pig.pdf [delete %pig.pdf]
count: 0
pdf-document: copy []
foreach letter letters [
ctx-letter: context letter
bind page-template in ctx-letter 'self
page: compose/deep page-template
append/only pdf-document page
count: count + 1
]
write/binary %pig.pdf layout-pdf pdf-document
browse %pig.pdf
ask "Continue? "
delete %pig.pdf
Now it is time for my sleep :^)
Brett.