Search code examples
pdfcheckboxsmalltalkvisualworks

How does one enter a 'checkbox' character on a pdf generated by report4pdf?


So I am working on generating PDFs using the report4PDF package(bob nemec) from the VisualWorks 8.1 software from Cincom. I am doing everything in 'smalltalk'.

However right now, the issue I am facing is that I can't get a checkbox character to show up on the PDF.

So my code would go along like this:

pdfDocument := Report4PDF.R4PReport new.
exporter := SAGETEAPDFDataExporter onDocument: pdfDocument.
exporter currentText text string:' Available'.
"Followed by relevant code to save PDF"

But what shows up on my PDF is basically ' Available'. A space appears instead of the checkbox symbol. I even tried using dingbats codes(e.g: #9744 ). Works with the copyright, alpha, gamma symbols. Not with the checkbox symbol.

I tried updating my VisualWorks image from the public repository using the report4pdf, pdf development and fonts development packages. Ran into some issues which I wont mention since it will derail us from the topic.

Thanks in Advance!


Solution

  • Okay... So I ended up finding a solution to this question. I will just post the answer here just in case anyone else gets in a similar situation.

        pdfDocument := Report4PDF.R4PReport new.
        exporter := SAGETEAPDFDataExporter onDocument: pdfDocument.
        exporter currentText text:[:text|
             text string zapfDingbats ;string:'q'. 
             text string helvetica; string:'Available' ]. 
    

    So you can use dingbats font to get a similar character for checkbox. You use mixed fonts to get something like this:' (Checkbox) Available'. So that's like the string is: 'q Available'. But 'q' is of the dingbats font while the 'Available' substring is of Helvetica.

    Hope that helped. And thank you again @Leandro for trying to help me :)

    Cheers!