Free Support Forum - aspose.com

Chinese Simplified Characters are appearing as boxes after converting HTML to PDF

chinese_simplified.zip (270.3 KB)

Hi, We are trying to convert HTML template to PDF, the template is in “Simplified Chinese” language but after conversion through aspose pdf library it is showing box characters for some of the Chinese characters. This is high priority issue and we need to fix it as early as possible. Kindly let me know if there is any fix for this.

I have tried the same code but It is not working. I have even tried with simple Chinese String as mentioned below but it is still converting some of the characters to boxes.

这句话后来演变成“饮水思源”这个成语,意为喝水的时候想一想流水的源头,比喻不忘本。aspose_chinese_simplified.pdf (141.6 KB)

@poaspose

Thank you for contacting support.

We have worked with the data shared by you but the issue is not reproduced in our environment. The PDF file is generated exactly the way browser displays the HTML file. Please try using below code snippet in your environment and then share your kind feedback with us.

        var baseDir = @"D:\chinese_simplified\";
        HtmlLoadOptions options = new HtmlLoadOptions(baseDir);
        Document doc = new Document(baseDir + "Simplified.html", options);
        doc.Save(baseDir + "Simplified_18.6.pdf", Aspose.Pdf.SaveFormat.Pdf);

We have also attached generated PDF file for your kind reference Simplified_18.6.pdf. In case you notice any problem, please create screenshots to elaborate the problem so that we may proceed to help you further.

I have tried the same code but It is not working. I have even tried with simple Chinese String as mentioned below but it is still converting some of the characters to boxes.

这句话后来演变成“饮水思源”这个成语,意为喝水的时候想一想流水的源头,比喻不忘本。aspose_chinese_simplified.pdf (141.6 KB)

@poaspose

We have been able to reproduce the problem while adding Chinese text on a PDF page, while using below code snippet in our environment.

           // Open document
           Document pdfDocument = new Document();

           Page pdfPage = pdfDocument.Pages.Add();

           // Create text fragment
           TextFragment textFragment = new TextFragment("这句话后来演变成“饮水思源”这个成语,意为喝水的时候想一想流水的源头,比喻不忘本。");

           // Set text properties
           textFragment.TextState.FontSize = 12;
           textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);

           pdfPage.Paragraphs.Add(textFragment);

           // Save resulting PDF document.
           pdfDocument.Save(dataDir);

A ticket with ID PDFNET-44983 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi,
Can you please also check the attached template once you fix this issue. This is the template we are targeting.Simplified_new.zip (4.4 KB)

@poaspose

We have updated the data in respective ticket. We will get back to you as soon as some significant progress is made in this regard.

The issues you have found earlier (filed as PDFNET-44983) have been fixed in Aspose.PDF for .NET 18.8.