Home   Archive   Permalink



PDF-Maker with computed strings

HI!
    
I'm trying to produce a .pdf document from within a Rebol script using PDF-Maker, version 1.27, where the text to be output is concatenated based on conditional statements.
    
I've been following Nick's great tutorial and understand that when using computed values it is very important to include the compose/deep evaluation. I was able to run Nick's example but when I try the following, the page comes out blank. Any ideas why?
    
R E B O L []
do %pdf-maker.r
mytext: {This text would be built by conditional string concatenation}
page1: compose/deep [
    [
         page size 215.9 279.4
         textbox [ mytext ]
     ]
]
write/binary %mypdf.pdf layout-pdf page1
call %mypdf.pdf
    
Thanks in advance!

posted by:   Brother Damian       9-Sep-2016/8:47:45-7:00



Have you checked the value of page1?
    
I get
== [[
         page size 215.9 279.4
         textbox [mytext]
     ]]
Try this:
page1: compose/deep [
     [
         page size 215.9 279.4
         textbox [ (mytext) ]
     ]
]
Now this result is:
== [[
         page size 215.9 279.4
         textbox [{This text would be built by conditional string concatenation}]
     ]]
Better?
    
    


posted by:   Arnold       9-Sep-2016/15:47-7:00



In trying to get the value from the word 'mytext, I have attempted to replace it with:
    
:mytext
rejoin [ mytext " " ]
Reduce (mytext)
compose (mytext)
    
But they all return a blank page.
    
Any suggestions?

posted by:   Brother Damian       9-Sep-2016/16:02:06-7:00



Hi Arnold, the replacement:
    
(mytext)
    
worked perfectly. Thanks for your help.
    
I guess that the compose/deep needed the parentheses to evaluate the expression and no further effort was necessary.

posted by:   Brother Damian       9-Sep-2016/16:06:37-7:00



Yes, and you could have known if you had read a little further on to the next example, that used the () frequently. (Strangely I remembered I could use them).

posted by:   Arnold       10-Sep-2016/4:49:10-7:00