pdf-maker.r
[1/11] from: louisaturk::eudoramail::com at: 17-Apr-2002 23:56
Hi Gabriele Santilli and other fellow rebols,
I am only now realizing why make-doc-pro and pdf-maker are so important to
rebol users---platform independent printing. In fact, the only way to
print to paper (am I correct about this?).
Question 1: Why won't page three (below) print the contents of the
variable named letter? I get a blank page, but this is what I need to be
able to do to dynamically create the pages for printing. (The following
best viewed with Courier font.)
REBOL []
do %pdf-maker.r
letter: {Date Check# Reg. Support Special
=========== ========= ============ ===========
26-Jan-2001 298 $40.00 $0.00
9-Feb-2001 315 $40.00 $0.00
22-Mar-2001 344 $40.00 $0.00
}
write/binary %pig.pdf layout-pdf [
[ ;page 1
textbox [font Courier 4.8 "Example text 1."]
] [ ;page 2
textbox [center font Helvetica 2.8 "What?"]
] [ ;page 3
textbox [font Courier 4.8 letter]
]
]
browse %pig.pdf
Question 2: Is it possible to read into pdf-maker.r a pre formatted
text-only document (like that contained in the variable named letter
above), and have it printed as pre formatted without further coding? Or is
it necessary to change linefeeds to newline or ^/ etc.?
Question 3: How can one turn off justification?
Question 4: I have version 1.21.0 of pdf-maker.r. Is that the latest?
Question 5: I have a 6 page pdf-maker-doc.pdf, and a pdf-maker-doc.r. Is
there more documentation somewhere?
Question 6: What is the purpose of the following line at the beginning of
pdf-maker-doc.r:
rebolface: load 64#{..content deleted here..}
Thanks for making pdf-maker.r available, Gabriele!
Louis
[2/11] from: gchiu:compkarori at: 18-Apr-2002 23:36
On Wed, 17 Apr 2002 23:56:33 -0500
"Dr. Louis A. Turk" <[louisaturk--eudoramail--com]> wrote:
> Question 1: Why won't page three (below) print the
> contents of the
> variable named letter? I get a blank page, but this is
Do you need to 'reduce the block first?
Does the PDF maker support images eg. jpgs etc?
--
Graham Chiu
[3/11] from: greggirwin:mindspring at: 18-Apr-2002 10:09
Hi Louis,
<< I am only now realizing why make-doc-pro and pdf-maker are so important
to
rebol users---platform independent printing. In fact, the only way to
print to paper (am I correct about this?). >>
You can write HTML files and use the browser to print them or, in some
cases, you can dump things directly to the printer, but pdf-maker gives you
the most control over the output in a nice platform independent way.
<< Question 1: Why won't page three (below) print the contents of the
variable named letter? I get a blank page, but this is what I need to be
able to do to dynamically create the pages for printing. (The following
best viewed with Courier font.) >>
Your block contains the word 'letter, but pdf-maker doesn't know what to do
with it. You need to do something like this to put the value of 'letter in
there.
pdf-block: compose/deep [
[ ;page 1
textbox [font Courier 4.8 "Example text 1."]
] [ ;page 2
textbox [center font Helvetica 2.8 "What?"]
] [ ;page 3
textbox [font Courier 4.8 (letter)]
]
]
COMPOSE lets you specify which parts of the block to reduce by putting them
in parens.
<< Question 2: Is it possible to read into pdf-maker.r a pre formatted
text-only document (like that contained in the variable named letter
above), and have it printed as pre formatted without further coding? Or is
it necessary to change linefeeds to newline or ^/ etc.? >>
Hmmm. I haven't tried that. Maybe Gabriele will jump in and let us know if
you could create one big text box to do that.
<< Question 5: I have a 6 page pdf-maker-doc.pdf, and a pdf-maker-doc.r.
Is
there more documentation somewhere? >>
I don't think so. Keep notes as you're trying things out with it and pass
them along to Gabriele. Then there will be more. :)
<< Question 6: What is the purpose of the following line at the beginning of
pdf-maker-doc.r:
rebolface: load 64#{..content deleted here..} >>
I have 1.20 here, and it doesn't contain that. The only decompress it has is
for the font metrics.
--Gregg
[4/11] from: g:santilli:tiscalinet:it at: 18-Apr-2002 21:49
Hi Graham,
On Thursday, April 18, 2002, 1:36:20 PM, you wrote:
GC> Does the PDF maker support images eg. jpgs etc?
Yes. It uses REBOL/View images so you can load everything REBOL
can load.
(No compression yet in the output file, so you'll get big files
with images; Gregg provided some code for RLE compression, but I
still have to look into integrating it with PDF Maker.)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[5/11] from: g:santilli:tiscalinet:it at: 18-Apr-2002 21:45
Hi Luis,
On Thursday, April 18, 2002, 6:56:33 AM, you wrote:
DLAT> Question 1: Why won't page three (below) print the contents of the
DLAT> variable named letter?
Because PDF Maker's dialect does not evaluate words. (That needs
to be added somehow, I hope I will be able to someday. :)
Workaroud: use compose/deep.
write/binary %pig.pdf layout-pdf compose/deep [
[ ;page 1
textbox [font Courier 4.8 "Example text 1."]
] [ ;page 2
textbox [center font Helvetica 2.8 "What?"]
] [ ;page 3
textbox [font Courier 4.8 (letter)]
]
]
DLAT> Question 2: Is it possible to read into pdf-maker.r a pre formatted
DLAT> text-only document (like that contained in the variable named letter
DLAT> above), and have it printed as pre formatted without further coding? Or is
DLAT> it necessary to change linefeeds to newline or ^/ etc.?
DLAT> Question 3: How can one turn off justification?
You can use the following paragraph alignments:
textbox 15 100 100 160 [
justify {This paragraph will be justified. This is the default
paragraph alignment. Original text formatting is
lost.}
left align {This paragraph will be left aligned. Original text
formatting is lost.}
right align {This paragraph will be right aligned. Original text
formatting is lost.}
center {This paragraph will be centered in the textbox.
Original text formatting is lost.}
as-is {This paragraph will be left aligned.
The text will be rendered as is, so the original
formatting
is preserved. This is what you are looking
for if I understand correctly.}
]
DLAT> Question 4: I have version 1.21.0 of pdf-maker.r. Is that the latest?
Yup. :-)
DLAT> Question 5: I have a 6 page pdf-maker-doc.pdf, and a pdf-maker-doc.r. Is
DLAT> there more documentation somewhere?
Unfortunately, no. I am the one to blame for this.
DLAT> Question 6: What is the purpose of the following line at the beginning of
DLAT> pdf-maker-doc.r:
It's the image of a REBOL face that appears in the second page.
DLAT> Thanks for making pdf-maker.r available, Gabriele!
I'm very glad you find it useful!
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[6/11] from: louisaturk:eudoramail at: 19-Apr-2002 6:53
Hi Gabriele and everyone else that has helped me learn how to print to papers,
It is early morning here and I haven't gone to bed yet (this is my last day
to try to meet a deadline), so please forgive me for not naming all of you
that have so graciously helped me, but please accept my sincere
thanks. Gabriele, I especially owe you for the excellent job you did with
pdf-maker.r and for explaining to me how to use it. You are one of my
heros for sure now!
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):
REBOL []
do %pdf-maker.r
if exists? %pig.pdf [delete %pig.pdf]
count: 0
lets: copy [{AAAAAAAAA} {BBBBBBB} {CCCCCC}] ; short informative sample
reports :>)
pdf: copy {}
pdf: {write/binary %pig.pdf layout-pdf [}
foreach let lets [
pdf: join pdf compose/deep [{[textbox [} [font Courier 4.4 as-is
{^{}(let){^}]]}]]
count: count + 1
]
pdf: join pdf {]}
pdf: replace/all pdf {^{ } {^{} ;removes leading white space---trim didn't
work.
pdf: replace/all pdf { ^}} {^}} ;why are these two lines needed?
print pdf
do pdf
browse %pig.pdf
ask "Continue? "
delete %pig.pdf
Thanks again everybody!
Louis
At 09:45 PM 4/18/2002 +0200, you wrote:
[7/11] 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.
[8/11] from: anton:lexicon at: 20-Apr-2002 1:22
Good explanation Brett,
Most newcomers to rebol seem to pick up modifying
strings before modifying code blocks. What's so
difficult about modifying blocks of code?
The magic word is:
compose
I use this on a regular basis. Everyone needs
to know how it works. It is cool. It is also
necessary for composing your code blocks in a
clean way.
Although I am not really expecting it here on this
list, I don't see a script header. If you are not
using script headers, I recommend them to you and
anyone else reading. All my scripts have them.
You can see Rebol Technologies standard header here:
probe system/standard/script
I think the most important fields are:
Title, Date, Version, Author and Purpose.
Anton.
[9/11] 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.
[10/11] from: louisaturk:eudoramail at: 19-Apr-2002 14:44
Hi Brett,
Wow! Your two posts help. You guys are really going beyond the call of
duty to educate me. I have learned a lot this week, yet I feel
increasingly ignorant. There is a lot more to the rebol language than I
realized. I think that so far I have only seen the tip of an
iceburg. Hey, but rebol is hot, not cold! But it is cool. :>)
Thanks,
Louis
At 12:11 AM 4/20/2002 +1000, you wrote:
[11/11] from: robert:muench:robertmuench at: 20-Apr-2002 15:08
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 5>>
> rebol users---platform independent printing. In fact, the only way to
> print to paper (am I correct about this?).
Hi, yes I think you are. Supporting PDF-maker dialect-output is highest on my
to-do list for MDP. So you can decide to have HTML or PDF. Robert
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted