We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The unicode problem in the output of the PDF file using aspose pdf for .net

I am using aspose components for generating pdf file from asp.net page’s file stream.

I am trying to generate multiple payslip with japanese contents in the single pdf file.

The problem is i am able to generate the pdf file using below code snippet but the first payslip’s content comes without japanese content(hidden) but the subsequent payslip comes with japanese contents in the final output pdf file.

I am attaching output file for your reference and the below is the code for it.

Please do needful thing as soon as possible.

// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section sect = pdf.Sections.Add();

var strWriter = new StringWriter();
byte[] data = AECrypt.EncryptWithSymmetricAid(rowNo, PublicKey);
var navistring = Convert.ToBase64String(data);
Server.Execute(string.Format("~/pub/PDFGenerator.aspx?id={0}", navistring), strWriter);

// Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text txtContent = new Aspose.Pdf.Generator.Text(strWriter.ToString());

// enable the property to display HTML contents within their own formatting
txtContent.IsHtmlTagSupported = true;
txtContent.IsFirstParagraph = true;
txtContent.IsFitToPage = true;
txtContent.UseTextInfoStyle = true;
txtContent.TextInfo.IsUnicode = true;
txtContent.TextInfo.FontName = “Arial Unicode MS”;
txtContent.TextInfo.FontEncoding = “utf-8”;
txtContent.TextInfo.IsUnicode = true;
txtContent.TextInfo.TruetypeFontFileName = “Arial Unicode MS”;

sect.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A4Height;
sect.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A4Width;

//Instantiate the MarginInfo instance
Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();

marginInfo.Top = 42;
marginInfo.Bottom = 42;
marginInfo.Left = 40;
marginInfo.Right = 40;

// Assign the marginInfo instance to Margin property of section.PageInfo
sect.PageInfo.Margin = marginInfo;

// Add the text paragraphs containing HTML text to the section
sect.Paragraphs.Add(txtContent);
sect.IsNewPage = true;

Hi Kumar,


Thanks for your inquiry. Please share your input HTML, so we will test the scenario at our end and will provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Kumar,


Thanks for contacting support.

Adding more to Tilal’s comments, I have tested the scenario using latest release of Aspose.Pdf for .NET 9.3.0 and I am unable to notice any issue. I have tested the scenario in both licensed as well as trial mode.

The source HTML (rename extension to .html) and resultant PDF are attached. However, as requested, please share the resource file so that we can further investigate this problem at our end. We are sorry for your inconvenience.