Most of you working with Director should know the PDF Class of Valentin Schmidt very well. It’s a set of parent scripts generating PDF files on the fly within Director. It’s very cool, because IMHO it outnumbers Impressario in some ways. And it is open source.
One of the mostly used features:
It’s able to generate a PDF file while maintaining the look of your formatted Textmembers with the AddMember() functionality. Unfortunately only TABs at the beginning of one line are interpreted. Every TAB in the same line after the first word is rendered as a space character.
Here is an unofficial patch that fixes the problem. Valentin is informed about it and will insert it in the official release in the future. His solution looks a little bit different, but it’s the same speaking of „functionality“.
1) Open up the script „PDF_TEXTMEMBER“ in the cast named „pdf“
2) Scroll to line 166 (str = chunk.txt) and delete the following:
if str<>„“ then
me.Write(me.pFontSizePt * 1.4, str, chunk.hl)
end if
3) After str = chunk.txt paste the following:
myCount = 1
repeat with x = 1 to str.char.count
— Create Substring of str
substr = str.char[myCount..x]
–check for TAB
if str.char[x] = TAB then
delete char x of substr
myCount = x
— Correct X-Value
me.SetX(x0 + tTextMem.charPosToLoc(lm[1]+x)[1])
if substr<>„“ then
me.Write(me.pFontSizePt * 1.4, substr, chunk.hl)
end if
else
if substr<>„“ then
me.Write(me.pFontSizePt * 1.4, substr, chunk.hl)
end if
end if
myCount = myCount+1
end repeat
4) You are done.
This few lines are searching for TABs in the parsed string and are calculating the right new position within the PDF.
