We have used version 18 for html to pdf generation. But in this version faced some overlapping issues in some non English languages like Chinese. So we upgraded the version to 22 and purchased new license also. In the latest version, while we trying to create pdf from html, the overlapping issues are fixed but it takes too much time.(In older version it took 3 minutes but now it is taking more than 7-8 minutes).
Please use the latest version of Aspose.PDF for .NET 22.5 to avoid this issue. If you still face problem, please share your input HTML here for testing. We will investigate the issue and provide you more information on it.
Much appreciated for your timely reply.
After using the latest version of Aspose.PDF for .NET 22.5, the overlapping issue is fixed but now it takes 7 to 8 minutes to generate the pdf. Previously (with Aspose version 18) it takes only 3 to 4(max) minutes to generate the pdf. Please find the attached html for which the issue exists.(the content is in non-English which is Traditional Chinese)Sample_HTML.zip (40.9 KB)
Thanks
We faced System.FormatException
while converting your HTML to PDF. Could you please share the code example that you are using?
HtmlLoadOptions options = new HtmlLoadOptions();
Document pdfDocument = new Document(MyDir + "Sample_HTML.htm", options);
pdfDocument.Save(MyDir + "html_test.PDF");
As requested, please find the below code snippet
var htmlStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(model.FormHtml));
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Top = 50;
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Left = 10;
htmlLoadOptions.PageInfo.Margin.Right = 10;
htmlLoadOptions.PageInfo.Width = paperSizeMapper.PDFSize.Width;
htmlLoadOptions.PageInfo.Height = paperSizeMapper.PDFSize.Height;
Document htmlDoc = new Document(htmlStream, htmlLoadOptions);
Document htmlDoc = new Document(htmlStream, htmlLoadOptions);
EYLogo = EYLogo.Replace(@"/", @"\").Replace("..", "");
var filePath = String.Format(@"{0}\" + EYLogo, ImagesFolder);
//create header
ImageStamp eyStamp = new ImageStamp(filePath);
//set properties of the stamp
eyStamp.TopMargin = 40;
eyStamp.RightMargin = 20;
FitImage(eyStamp, ScaleImage.ShrinkOnly, 40, null, true);
eyStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
eyStamp.VerticalAlignment = VerticalAlignment.Top;
if (model.SummaryFiles.Count() > 0)
Document doc = new Document(new MemoryStream(), htmlLoadOptions);
{
var summaryFileResult = AttachFileToPDF(doc, model.SummaryFiles, paperSizeMapper, errorHandlingOption, true);
if (summaryFileResult.FailBook)
{
return new PDFGeneratorResult() { Errors = summaryFileResult.Errors };
}
doc = summaryFileResult.doc;
doc.Pages.Add(htmlDoc.Pages);
if (summaryFileResult.Errors.Count > 0)
{
foreach (var error in summaryFileResult.Errors)
{
fileAttachmentErrors.Add(error);
}
}
}
else
{
doc = htmlDoc;
}
// Save PDF file
var resultStream = new MemoryStream();
doc.Save(resultStream);
var result = this.CompressPdf(resultStream);
You code contains compilation errors. Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.