Define Encoding when using DrawText

When building a PDF document using the new Xojo PDF tools, how do you tell the DrawText method that the text is encoded? Is this still true in 2023r2:

You can’t.

If you want anything more than a basic character set you need to use MBS or possibly Einhuger plugins.

So, @Javier_Menendez statement above from 2020 is still true 3 years later. That’s just sad …

It is NOT a trivial problem - there’s a lot of moving parts. PDFs are very user friendly but sometimes complex to create, and text is probably the most complicated feature to support.

But yeah, three years is a long time. In the ideal world my brain lives in, PDF support would not have been released without this functionality as it severely limits the feature’s usefulness. You really can’t use this to create form output, for example, if there is a chance that any of the variable data might contain a non-ASCII character (and you care about the accuracy of that information in the PDF). That implicates all name fields and address fields in the US, and basically all fields in non-English countries. There’s no way to use any non-Latin script so there goes all Asian scripts.

The workaround - image the text into a Picture and inserting the result into the document - works for human eyes but results in larger files that can’t be searched and poorer printed output.

Not a great situation for what could and would be a flagship product feature. Hopefully progress is being made towards a more complete implementation.


That is the type of things that drives me crazy about “new” features in Xojo… anytime you try to do anything non trivial they tend to come up lacking in some significant way…

They could have have built on top of an existing library with more functionality, but chose not to.

Anyway there are two commercial plugins that CAN use unicode as mentioned above.

If you have relatively modest needs and don’t want to spend a lot on a plugin the Einhugur PDF plugin is a reasonable choice. It is built on the open source LibHaru.

You get all the plugins in the Einhugur set (which include some nice controls). In this case you would probably want to build some higher level classes for some things like tables etc in Xojo (I did some of that).

If you want the kitchen sink and are less price sensitive there is the much more capable DynaPDFMBS plugin … which comes at various price points for different feature sets… and it can be a bit daunting!

Neither use Xojo.Graphics commands so there is more of a learning curve, with the Einhugur plugin being simpler (and IMO has easier to use documentation).

  • Karen
1 Like

Thanks, Karen - I’m shifting to the Einhugur version since my needs are very simple and can be achieved using the available Xojo PDF features - with the exception of UTF8 support …