PDF Document Text Encoding question

Text that I store and retrieve in an SQLite database in a Desktop project needs to be written in a PDF document using pdf.Graphics.DrawText.
The entered text is UTF8, which is stored in an SQLite textfield, and retrieved later on.
When I check before the DrawText command in the debugger, the (UTF8) text is fine,
but on the PDF, any special characters like ’ are converted to €31.
So a text like “Risico’s” shows up as “Risico€31 s”
How do I preserve the UTF8 encoding in the PDFdocument?

Never mind, found out that the text stored has the wrong encoding.

I’m having a similar problem but I can verify that my string is in fact UTF8.
Has anyone else encountered this?

Hi Chris, may you explain a bit more in detail the kind of problem you’re experiencing please?

Thank you!

Sure thing. Try this code:
My delta won’t render right. “∆”.
Any idea how to make it work?

> Var p As New PDFDocument( PDFDocument.PageSizes.Letter)
> Var g As graphics = p.Graphics
*> *
> Var t As String = “Accents: éèç and other characters ∆ ºº”
> g.FontName = “Helvetica”
> g.FontSize = 12
> g.DrawText t, 35, g.Height/2
*> *
> Var f As FolderItem = SpecialFolder.Desktop.child(“test.pdf”)
> If f.Exists Then f.Delete
> p.save f
> f.open

≤ and ≥ won’t show up either. I know these are supported characters in pdf…

Yes, right now the PDF documents are encoded as WinAnsiEncoding. That means a smaller character set when compared with Unicode.

We have plans to improve that in a further iteration of the class.

1 Like

That’s a limiting character set. Makes it unusable with many languages.

1 Like

Yep. Please, keep in mind that this is the first iteration :slight_smile: We are the first ones wanting this feature to be as much useful as we can for everyone out here!

1 Like

good to know. I can work within this limitation for now.

I am having other issues like drawPicture failing to show the image in the final pdf. I’m not seeing this as a known issue, and I can’t replicate it 100% of the time.
It’d be good to know what issues are out there.

hmmm… that one is weird. I have no bug reports about picture drawing. It would be good if you can reproduce the problem and create a bug report with a nice test project attached :ok_hand:t2:

Drawing pictures works fine for me.

It is for me too, but then it stops.
It almost seems like a memory issue.