Open rifi opened 7 years ago
Could be because the font does not support unicode mapping. Try looking for a unicode korean font (googling should suffice, would put somethibg myself but i dont know what you like), and use instead. If this will solve the problem, theb we know why, then we can discuss how to work with a font thats not unicode.
Regardless ill try to find some time soon to look into this. Gal
Instead of using Tj use writeText and add a font that can handle Korean Glyphs.
Dear sir, I was looking at the issue at hand, and found that when using NotoSansCJKkr-Regular.otf there's a bug that's awoken in the library. on my PC it was causing an endless loop. perhaps it was causing another effect on your side. fixing the bug, shows the characters as expected. Note that per @DamickDoni note, using writeText is a simpler version than running the BT-Tj-ET hupla, while being quite equivalent in all terms.
this sample program shows how, and i checked it to work:
var hummus = require('hummus')
var pdfWriter = hummus.createWriter('./hello.pdf',{log:'hello.log'})
var page = pdfWriter.createPage(0,0,595,842)
var cxt = pdfWriter.startPageContentContext(page);
var textOptions = {
font: pdfWriter.getFontForFile('./NotoSerifCJKkr-Regular.otf'),
size: 14,
colorspace: 'gray',
color: 0x00
};
pdfWriter.startPageContentContext(page).writeText('Hello World 한글 abc!',10,300,textOptions)
pdfWriter.writePage(page);
pdfWriter.end();
you should be using version 1.0.83 of hummus to get the correction.
Hi.. I don't know how to write korean character and how to use korean font. I am beginner in pdf programming. So I read ocumentation and issues. But I don't understand..
My Test text is 'Hello World 한글 abc!'. Korean text part '한글' not display
Can I use korean characters? If possible, how to use? Git include test font not display or blank box or etc ....
I tried NotoSansCJKkr(otf) - https://www.google.com/get/noto/#serif-kore How can I use this font? If possible, how?
My test code
var contentContext = pdfWriter.startPageContentContext(page); [pdfWriter.getFontForFile(__dirname + '/TestMaterials/fonts/NotoSansCJKkr-Regular.otf',0)
].forEach(function(element,index,array) { contentContext .BT() .k(0,0,0,1) .Tf(element,1) .Tm(30,0,0,30,78.4252,662.8997 - index*100) .Tj('Hello World 한글 abc!') .ET(); });
Thank u for reading... Help me