I am converting a Microsoft Access application that used VBA and the Debenu (now Foxit) PDF library for some reports. The Debenu library had a DrawHTMLText function that would style text based on a small subset of HTML. For example:
DrawHTMLText(left, top, width, "This is <b>bold</b> and this is <i>italic</i> text")
would print
This is bold and this is italic text
The function would also word wrap the text based on the width parameter.
I have searched the forum and have not found anything like this. Has anyone done anything similar? Does anyone have a suggestion for another approach to accomplish this?
Perhaps extending the DrawText method would be a way to do that? Any suggestions on how to approach that?
Thanks,
Dennis
1 Like
I had some code for that a looonnnggg time ago. Like 10 years. I’ll dig around in my SVN tomorrow.
Found it:
StyledLabel.rbo.zip (4.4 KB)
This is really old code.
Thank you Beatrix.
I will take a look at it.
Dennis
I’ve implemented this in PostScript but I don’t think that helps you any. 
Before I used the PDF library in the Access/VBA app I used QuickScript which is a PostScript formatter and generated the report in PostScript. I then shelled to GhostScript to generate the PDF. My goal here is to use the PDF capabilities of Xojo.
Making progress. Beatrix’s code is a help. For the particular report I am working on I don’t need word wrap, but I would like to wind up with a more general solution.
Dennis
Html sucks for making reports. I have a solution when I load html into a htmlviewer and then use the macOS functionality to create a PDF out of that. Then I add a header and page numbers.
I’m not trying to create the report in HTML. I am using Xojo code to create the PDF report. I am looking to have something like DrawText() that will accept a string with embedded text attributes. It would not have to be HTML syntax - markdown syntax would work also.
Perhaps this particular use case will clarify: I have been involved for many years with a non-profit, all volunteer emergency medical service that has provided basic life support and ambulance transport to local residents and business since 1937 all without any charge to our patients. The particular report is a member history report.
One section is a summary of offices held. I create it using the technique shown in Javier Menendez’s PDFTable from a RowSet blog post. It looks like this:
The second column is a single string printed by DrawText handling the word wrap and it works very well.
Another section summarizes the member’s work on committees and it looks like this:
I use bold text to signify that the member was a committee chair or co-chair in the particular year. A function similar to DrawText (or extending DrawText?) that would accept a string with some sort of markup signaling text attributes would be perfect.