LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unicode Font in a PDF report (iTextSharp)

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.

 

Test unicode propriétés.jpg

 

 

In the  iTextSharp documentation, we are suppose to be able to send unicode, but I don't understand how to do this in Labview.

String unicode.jpg

 

 

Append phrase VI.jpg

I read A List of Tips and Tools for using Unicode in LabVIEW but I am stuck.  Any ideas?

 

Jean-Marc

0 Kudos
Message 1 of 14
(11,686 Views)

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

0 Kudos
Message 2 of 14
(11,657 Views)

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”.

 

PDF 4I.jpg

 

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

 

0 Kudos
Message 3 of 14
(11,633 Views)

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.

0 Kudos
Message 4 of 14
(11,620 Views)

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

0 Kudos
Message 5 of 14
(11,604 Views)

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

 

0 Kudos
Message 6 of 14
(10,114 Views)

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.

 

Unicode paragraph.png

 

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.

Message 7 of 14
(10,100 Views)

Jean-Marc,

 

Thanks for the pointers.  I have it working now.  And thank you  for your toolkit.

 

Matthew

 

0 Kudos
Message 8 of 14
(10,083 Views)

Could you write a complete example, thanks.

0 Kudos
Message 9 of 14
(9,778 Views)

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)?

0 Kudos
Message 10 of 14
(9,760 Views)