Hi Team,
Can you please confirm if Aspose Pdf can be used to generate PDF in Kannada language. I have attached an html file and added the import statements for all the fonts which are supposed to generate Kannada text. The meta charset for utf-8 is also added. Now the Aspose Pdf code ( below ) is generating the kannada text but the font syllables are not correct. You can validate this by converting it and comparingGetCaseRegistration_Kannada.zip (3.8 KB)
.
public byte[] GeneratePdf()
{
byte[] documentBytes;
using var doc = new Document();
// Create a section in the Pdf object
Aspose.Pdf.Page page = doc.Pages.Add();
var htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions
{
InputEncoding = nameof(Encoding.UTF8),
IsEmbedFonts = true,
};
var chineseFragement = new Aspose.Pdf.HtmlFragment(" The Chinese Text Project (CTP; Chinese: 中國哲學書電子化計劃) is a digital library project");
var germanFragement = new Aspose.Pdf.Text.TextFragment("Es war ein super-schwüller Tag. Wir konnten die Hitze kaum ertragen und entschlossen ");
germanFragement.TextState.FontSize = 8;
germanFragement.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial Unicode MS");
germanFragement.TextState.Font.IsEmbedded = true;
var fragment = new Aspose.Pdf.HtmlFragment("ಜಿಲ್ಲೆ ಪೊಲೀಸ್ ಠಾಣೆಯ ವಿವರಗಳು\r\nಕಾಯ್ದೆಗಳು ಮತ್ತು ಕಲಂಗಳು\r\nಕೃತ್ಯ ನಡೆದ ಸಮಯ\r\nಘಟನೆ ನಡೆದ ಸ್ಥಳ\r\nಫಿರ್ಯಾದುದಾರ/ಬಾತ್ಮೀದಾರ\r\nಆರೋಪಿಯ ವಿವರ\r\nನೋಂದವರ ವಿವರ\r\nಕಳವಾದ/ಬಾಗಿಯಾದ ಸ್ವತ್ತುಗಳ ವಿವರಗಳು\r\nಪ್ರ.ವ.ವ ಸಾರಾಂಶ\r\nತೆಗೆದುಕೊಂಡ ಕ್ರಮ\r\nಪಿರ್ಯಾದುದಾರರ ಸಹಿ\r\nನ್ಯಾಯಾಲಯಕ್ಕೆ ರವಾನೆಯಾದ ಸಮಯ\r\nನ್ಯಾಯಾಲಯಕ್ಕೆ ಪ್ರ.ವ.ವ ತೆಗೆದುಕೊಂಡು ಹೋದವರು ಹೆಚ್.ಸಿ/ಪಿ.ಸಿ\r\nಇತರ ವಿವರಗಳು\r\nಠಾಣಾಧಿಕಾರಿಯ ಸಹಿ");
page.Paragraphs.Add(fragment);
page.Paragraphs.Add(chineseFragement);
page.Paragraphs.Add(germanFragement);
using var documentStream = new MemoryStream();
doc.Save(documentStream, SaveFormat.Pdf);
documentBytes = documentStream.ToArray();
doc.FreeMemory();
return documentBytes;
}
The above code is working fine for the Chinese and German language, but not converting the kannada font correctly.
Found the same issue if I am using the Aspose html to pdf online convertor tool.
Can you please validate the behavior at your end and let me know. One quick note, this testing is performed locally on the Windows system.
Regards,
Vishesh