You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Eclipse BIRT Report Designer to generate reports in PDF format, but I’m facing issues with rendering Khmer Unicode Font. The Khmer characters either:
Appear as blank or missing text, or
Show incorrect khmer characters.
I've tested generating a simple PDF using OpenPDF with the Hanuman font. Here’s the code I used:
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws DocumentException, IOException {
// Output PDF file
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("Khmer_Font_Test.pdf"));
} catch (DocumentException | FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
document.open();
// Load Hanuman TTF font
BaseFont hanumanFont = BaseFont.createFont("/Users/sinsarath/eclipse-workspace/SamplePdf/fonts/Hanuman.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font font = new Font(hanumanFont, 14); // Set font size to 14
// Add Khmer text
String khmerText = "លេខ";
document.add(new Paragraph(khmerText, font));
document.close();
System.out.println("PDF generated successfully!");
}
}
Result are render not correct:
It should be displayed like that: លេខ
The text was updated successfully, but these errors were encountered:
@vk-github18 Thanks for your hint, this was helpful for the original cause which was coming from the BIRT-project - discussion: eclipse-birt/birt#2040
Short additional hint to the reference, the layout-processor enabling LayoutProcessor.enableKernLiga(); must be done before the BaseFont is created to support advanced glyph handling.
Hello everyone,
I'm using Eclipse BIRT Report Designer to generate reports in PDF format, but I’m facing issues with rendering Khmer Unicode Font. The Khmer characters either:
I've tested generating a simple PDF using OpenPDF with the Hanuman font. Here’s the code I used:
Result are render not correct:
It should be displayed like that: លេខ
The text was updated successfully, but these errors were encountered: