Here's an example of dynamically composing a PDF document
using records:

;; ======================================================
do %pdf-maker.r
records: [
    [first_name "Tim" last_name "Johnson"]
    [first_name "Gabriele" last_name "Santilli"]
    ]
build-page: func[record[block!]][
    blue-font: [FONT Courier 4.23 0.0.200]
    black-font: [FONT Helvetica 4.23 0.0.0]
    ;; Place any code that you want evaluated inside of parenthesis
    [ ;; Each page must be a block
        textbox[
            LEFT ALIGN
            (blue-font) "First Name: "
            (black-font) (record/first_name) newline
            (blue-font)  "Last Name: "
            (black-font) (record/last_name) newline
            ]
        ]
    ]
;; make block for the document
document: make block! length? records
;; Process records
 foreach record records[
    ;; Use 'compose to evaluate the code and data
    ;; inside of the parens in the 'page block
    page: compose/deep build-page record
    ;; append as a block
    append/only document page
    ]
write/binary %pdf-test.pdf layout-pdf document
;; ======================================================

It's my hope that someone else may find this as helpful
as it was for me in doing it. 
And as always - thanks to Gabrielle for his good work.
cheers
Tim

-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to