World: r3wp
[PDF-Maker] discuss Gabriele's pdf-maker
older newer | first last |
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. | |
Graham 23-Aug-2010 [728] | ok understood |
Gabriele 23-Aug-2010 [729] | you can have different templates for even and odd pages. |
Graham 23-Aug-2010 [730] | drop-image? |
Gabriele 23-Aug-2010 [731] | flowing text around an image? not implemented yet. it's not trivial unless the image is fixed within the text. (this is a limitation of the TeX algorithm, the width of each row of text must be known in advance) |
Graham 23-Aug-2010 [732] | drop-image load %"Gabriele Fototessera small.jpg" |
Gabriele 23-Aug-2010 [733x2] | ah, i think that is a custom function. you can define your own "functions" or "macros" within the dialect. |
define-func 'drop-image [img font size /local iw ih lh mrgns] [ ( iw: img/size/x / 5.34 ih: img/size/y / 5.34 lh: pdfm/get-font-info font size lh: lh/max-height + lh/max-depth mrgns: copy [0 0] loop round/ceiling ih / lh - 1 [ repend mrgns [iw + 2 0] ] append mrgns [0 0] none ) justify with margins mrgns box iw lh 0 [ image xbl ybl - ih + lh iw ih img ] space 2 font* font size ] | |
Graham 23-Aug-2010 [735] | ahh... ok |
Gabriele 23-Aug-2010 [736] | as you see, it determines the image size, then sets the text margins so that you can make it flow around the image. it's a "trick" but it works if the image is not fixed within the page but moves around with the text, and you know it won't be split across pages. |
Graham 23-Aug-2010 [737] | so if you were doing a watermark you don't alter the text margins |
Gabriele 23-Aug-2010 [738x2] | correct. |
you can also just put the image below the text boxes in the page template in that case. | |
Graham 23-Aug-2010 [740] | for a floating signature? |
Gabriele 23-Aug-2010 [741x2] | you can use a vbox [ ... ] and put any graphic command inside it. |
a box is "inline", eg, it is treated like it was a character. a vbox is considered more like a paragraph. | |
Graham 23-Aug-2010 [743x2] | Carl should use pdf-maker to generate PDFs of the online docs |
Is qtask using pdf-maker? | |
Gabriele 23-Aug-2010 [745] | no. initially, we wanted to use it for wikis (ie. see my qml to pdf code), but the fact that the pdf was not an exact replica of the html output was not considered acceptable. |
Graham 23-Aug-2010 [746] | I tried this append new-page compose/deep [ textbox 10 10 100 100 [ image 0 0 40 40 (load %247logo.png) ] ] and not seeing any image in the pdf .. |
older newer | first last |