11-27-2011 11:50 AM
I tried to use unicode font (Arial Unicode MS - arialuni.ttf) in a PDF document generated with iTextSharp. I am able to create the PDF document with this font.
In the iTextSharp documentation, we are suppose to be able to send unicode, but I don't understand how to do this in Labview.
I read A List of Tips and Tools for using Unicode in LabVIEW but I am stuck. Any ideas?
Jean-Marc
11-28-2011 12:11 PM
Jean-Marc,
These are great screenshots, but I am a little unclear with what you are trying to accomplish. Tell us a little bit about your application so we can point you in the right direction.
Regards,
Alexander M
Applications Engineer
National Instruments
11-30-2011 11:16 AM
Sorry for the lack of details. I use iTextSharp to generate PDF document with LabVIEW.
“iTextSharp is a port of the iText open source java library for PDF generation written entirely in C# for the .NET platform. (source: http://sourceforge.net/projects/itextsharp/)”
Everything works fine with ASCII characters but I am not able to generate PDF document with Unicode characters.
If I try to generate a PDF with the character 水 (UTF-16(hex) = 6C 34 or UTF-16LE (hex) = 34 6C), the result in the PDF is “4I”.
It is the fisrt time I work with unicode characters and I am lost. I tried some conversion VI from A List of Tips and Tools for using Unicode in LabVIEW, but without results.
Jean-Marc
11-30-2011 02:07 PM
I can't help you much since I don't have any iTextSharp experience but I can see from your original screenshot that the font is using ANSI encoding. You will need to get this changed to UTF-8 (for example) to handle the higher codes.
12-01-2011 12:21 PM
Jean-Marc,
To the best of my knowledge, Unicode is not officially supported in LabVIEW. This doesn't mean Unicode won't work, it just means National Instruments does not have any dedicated resources and can only offer limited support. Your best bet is still the A List of Tips and Tools for using Unicode in LabVIEW Developer Zone article. Make sure to follow the detailed steps listed before going straight for the attached VIs. The only other article I found that may be pertinent to displaying Unicode is Displaying Non-English Characters in LabVIEW.
Regards,
Alexander M
Applications Engineer
National Instruments
08-21-2014 08:02 AM
Jean-Marc,
I've sen other posts that you have a new version using unicode, so can you point me in the right direction as to how you got this to work? I have a unicode font and set up the Identity-H encoding, but the PDF just doesn't want to display the characters correctly. I have tried the \u codes and it just prints out the literal string.
Thanks,
Matthew
08-21-2014 09:49 AM - edited 08-21-2014 09:50 AM
I don’t have the new version in my actual computer. I will go by memory.
1) I found no way to connect a LabVIEW string to an Unicode iTextSharp phrase or paragraph;
2) The only way I found is to add a .NET string (mscorlib.system.string --> Unicode Basic Multilingual Plane) to an iTextSharp phrase or paragraph.
3) You construct this .NET string with an array of UTF16.
To construct the U16[ ]:
1) I wrote the text in NotePad (Unicode).
2) I copy the string in a LabVIEW string (not Unicode);
3) I remove the BOM;
4) I swap the bytes (2 bytes by to 2 bytes) and I typecast in U16.
08-21-2014 12:15 PM
Jean-Marc,
Thanks for the pointers. I have it working now. And thank you for your toolkit.
Matthew
11-07-2014 03:01 AM - edited 11-07-2014 03:05 AM
Could you write a complete example, thanks.
11-07-2014 09:24 AM - edited 11-07-2014 09:30 AM
A complete example is the new version of the library... I am not sure if I will release this version, but i am willing to give you some information.
What do you want to do exactly?
Which font do you want to use?
Which direction of writing (left to right or right to left)?