Please install the fonts used in your HTML on the system where you are converting HTML to PDF to avoid this issue. Moreover, we suggest you please use the latest version of Aspose.PDF for .NET 22.10.
@tahir.manzoor After the upgrade of the version to 22.10. Japanese text is rendering fine, however, the issue still exists with Bangali and Hindi languages as well. You’ve mentioned that install the fonts on the machine. But I’m not specifying any font in HTML.
Please install ‘Nirmala UI’ font and use following code example to avoid the shared issue. Hope this helps you.
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
FontRepository.getSubstitutions().add(new PdfFontSubstitution());
var document = new Document(MyDir + "Aspose-html to pdf issue.html", htmloptions);
document.save(MyDir + "22.10.pdf");
@tahir.manzoor In your above solution, I have to always specify different fonts according to language. But users can add content in any language, I have tested Bengali, Hindi, and Japanese at the moment but my assumption is there are also other languages that aren’t rendering properly.
here is the code snippet I’m using in .NET.
var htmlContent = $“My multi-lingual html {content}”;
using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(htmlContent)))
{
var options = new HtmlLoadOptions();
var pdfDocument = new Aspose.Pdf.Document(memoryStream, options);
using var outputMemoryStream = new MemoryStream();
pdfDocument.RemoveMetadata();
pdfDocument.Info.Author = string.Empty;
pdfDocument.Info.Title = string.Empty;
pdfDocument.Save(outputMemoryStream);
return outputMemoryStream.ToArray();
}
In your case you need to install fonts related Bengali, Hindi, and Japanese languages. You do not need to specify the font as suggested in my previous font.
For your case, we have logged a ticket as PDFJAVA-42195 in our issue tracking system. We will inform you once there is an update available on it. We apologize for your inconvenience.
Currently, your issue is pending for analysis and is in the queue. Once our product team completes the analysis of your issue, we will then be able to provide you an estimate.
Regretfully, the ticket could not get resolved due to other pending issues in the queue. Nevertheless, your concerns have been recorded and we will surely inform you as soon as we make some progress towards ticket resolution. Please be patient and spare us some time.