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

World: r3wp

[PDF-Maker] discuss Gabriele's pdf-maker

Gabriele
23-Aug-2010
[678x2]
image x y w h load %file.jpg
i don't yet have a way to include the JPG data directly, i use the 
loaded image. this means that the image gets in the pdf without compression.
Graham
23-Aug-2010
[680]
and all measurements are in mm ?
Gabriele
23-Aug-2010
[681]
yes, unless you set transformations to use different units.
Graham
23-Aug-2010
[682x2]
can we use points instead then?
72 points to an inch
Gabriele
23-Aug-2010
[684]
i think one point is 0.35 mm, so     apply scaling 0.35 0.35 [...points 
inside here...]      should work
Graham
23-Aug-2010
[685]
ok, great
Gabriele
23-Aug-2010
[686]
(if you need greater precision, you can probably find the exact conversion 
factor on google)
Graham
23-Aug-2010
[687]
so 

for i 1 100 10 [
	apply transformation i i [
		image i i w h load %file.jpg		
	]
]

would work?
Gabriele
23-Aug-2010
[688x2]
transformation
 = ?
translation?
Graham
23-Aug-2010
[690]
translation :)
Gabriele
23-Aug-2010
[691]
if so yes, but maybe you want 0 0 for the image origin?
Graham
23-Aug-2010
[692]
oh yeah ...
Gabriele
23-Aug-2010
[693]
the x and y for images are there so that you don't have to use a 
translation each time :)
Graham
23-Aug-2010
[694x3]
the other way it moves faster off the page
I think Nick has enough to start the tutorial :)
The question for tomorrow is .. how to get a block of text fully 
justified with microkerning
Gabriele
23-Aug-2010
[697]
simplest form (default values used for everything):

textbox [
    "This is an example"
]
Graham
23-Aug-2010
[698]
that does both left and right justification?
Gabriele
23-Aug-2010
[699x2]
yes, that is the default.
(you'll need a longer string to see it of course :)
Graham
23-Aug-2010
[701]
do you have a hyphenation dictionary?
Gabriele
23-Aug-2010
[702]
no, you have to handle that.
Graham
23-Aug-2010
[703]
so does it just wrap on words?
Gabriele
23-Aug-2010
[704x5]
yes.
you can define hyphenation points with --
eg.: "This is an ex" -- "am" -- "ple"
so if you have a dictionary, you can preprocess your text and just 
output that.
hyphens have a slight penalty so the engine will try to avoid them 
unless necessary. it also tries to avoid more than one in a row.
Graham
23-Aug-2010
[709]
kerning?
Gabriele
23-Aug-2010
[710x3]
it is automatic.
you can add manual kerning with the kern command
eg. "abc" kern 1 "def"
Graham
23-Aug-2010
[713x2]
so if text flow is automatic ... how do you know if the text overlows 
the box provided?
or, how does one flow text from one page to the next ?
Gabriele
23-Aug-2010
[715]
what you can do is create a stream of text, and then flow it across 
multiple text boxes, or multiple pages.
Graham
23-Aug-2010
[716]
eg ?
Gabriele
23-Aug-2010
[717x4]
for example, see the text that starts at page 4 in the test.pdf file?
that is defined in the test-pdfm.r file where it says:

text book [
    ....
]
then, the pages are defined as:

    any [
        textbox  10 29 90 248 from book
        textbox 110 29 90 248 from book
    ]
which means: "create ANY number of pages, as necessary, using the 
following as the template for each page"
Graham
23-Aug-2010
[721]
so that means you must have headers and footers too?
Gabriele
23-Aug-2010
[722x2]
the template can include anything you wish, images, other text, etc.
i don't remember if page numbers are implemented or not
Graham
23-Aug-2010
[724]
so book is the template?
Gabriele
23-Aug-2010
[725x3]
book is the text stream. the block with the two textboxes is the 
template (two columns)
the text stream is flown inside the columns.
so, it gets rendered inside the first textbox, any text that does 
not fit goes to the second textbox, if there is still more text, 
a new page is created and so on.