Product: PDF SDK
Product Version: PDFNetPython3==9.4.0
Please give a brief summary of your issue: How do I get the character codes for a particular unicode string?
Please describe your issue and provide steps to reproduce it:
I have looked at the following examples:
https://groups.google.com/g/pdfnet-sdk/c/b6gXWPhfyZA?pli=1
So I know that I can create a Font with the unicode characters I need with something like:
text_content = ‘Ànthöné’
Font.Create(doc.GetSDFDoc(), “Helvetica”, text_content)
And use the font with the element builder to create the text object. My question is, how do I get the character codes for the Font for the unicode characters in my string above (text_content). Specifically, I would need to know the character codes for the Font for, [‘À’, ‘ö’, ‘é’]. How do I get these dynamically from the Font? I know there is Font.MapToUnicode, and I would just need the opposite.
The Python examples show this having the codes already enumerated in hexadecimal:
# Latin
latin = ['a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 0x45, 0x0046, 0x00C0,
0x00C1, 0x00C2, 0x0143, 0x0144, 0x0145, 0x0152, '1', '2' ]# etc.
writer.WriteElement(eb.CreateUnicodeTextRun((latin), len(latin)))
writer.WriteElement(eb.CreateTextNewLine())
# Greek
greek = [0x039E, 0x039F, 0x03A0, 0x03A1,0x03A3, 0x03A6, 0x03A8, 0x03A9]
writer.WriteElement(eb.CreateUnicodeTextRun((greek), len(greek)))
writer.WriteElement(eb.CreateTextNewLine())
Thanks!