jung-kurt / luahpdf

LuaHPDF is a module that lets you programmatically create PDF files using Lua.
23 stars 10 forks source link

Is there utf-8 support? #10

Open ysharoiko opened 5 years ago

jung-kurt commented 5 years ago

This project is based on libharu which unfortunately does not support utf-8. According to the documentation, it does support various character set (ISO8859-1\~16, MSCP1250\~8, KOI8-R) including CJK fonts and encodings.

ysharoiko commented 5 years ago

Unfortunatly could not find any way to set encoding, maybe it can be done by loading different fonts

I see this result on pdf pdffonts.exe test.pdf Config Error: No display font for 'Symbol' Config Error: No display font for 'ZapfDingbats'

name type emb sub uni prob object ID location

Helvetica-Bold Type 1 no no no 15 0 external: C:\Windows\Fonts\arialbd.ttf Helvetica Type 1 no no no 16 0 external: C:\Windows\Fonts\arial.ttf Courier Type 1 no no no 17 0 external: C:\Windows\Fonts\cour.ttf Courier-Oblique Type 1 no no no 18 0 external: C:\Windows\Fonts\couri.ttf Helvetica-Oblique Type 1 no no no 19 0 external: C:\Windows\Fonts\ariali.ttf

No words about encoding

jung-kurt commented 5 years ago

The font_demo.lua examples shows how to work with the PDF native fonts, including ZapfDingbats. But I have not had luck demonstrating how to use the code page encodings. You may wish to read Encodings and Fonts in the libharu wiki. Also, I had forgotten that there is some support for Unicode and UTF-8, but unfortunately I don't have a good example that shows how to use these from a Lua script. If you have some success, please share your findings!