I’m try to generate PDF using inline HTML string. However the generated pdf is not same as HTML string which I provided (footer need to be loads at the very bottom of the full document).
Here the code snippet that I use to generation.
public static byte GetPdfFromHtml(string html, string mediaPath)
// Get the license
var asposeLicenseFileName = ConfigurationManager.AppSettings["AsposeLicPath"];
// instantiate the license class
var license = new AsposeLicense();
//pass only the name of the license file embedded in the assembly
catch (Exception ex)
// run as evaluation if this fails
NLogManager.LogGeneralError("Aspose PDF Generator",
"Could not load Aspose licence file. Please check the correct Aspose licence file : " + asposeLicenseFileName,
var objLoadOptions = new HtmlLoadOptions(mediaPath);
objLoadOptions.PageInfo.Margin.Bottom = 10;
objLoadOptions.PageInfo.Margin.Top = 30;
objLoadOptions.PageInfo.Margin.Left = 10;
objLoadOptions.PageInfo.Margin.Right = 10;
var doc = new Document(new MemoryStream(Encoding.UTF8.GetBytes(html)), objLoadOptions);
// Return bytes
using (var ms = new MemoryStream())
Please refer attachement PDF Resources.zip (150.0 KB)
HTML string that providing : HTML_string.html
Generated PDf : PDF_Output.pdf
Aspose version : 220.127.116.11
I have updated this as mentioned in PDF Generated broken on inline styled HTML string
We have tested the scenario in our environment while using Aspose.PDF for .NET 21.1 and were able to reproduce the issue. We have logged it as PDFNET-49307 in our issue tracking system for the sake of correction. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.
We apologize for the incovenience.
any update on this.
We have investigated the earlier logged ticket and found that it was not a Bug in the API. The API was generating an expected output PDF. Please check documentation and try to print document via browser.
The ticket has been closed now. Please feel free to ask in case you need further information.
We still getting the styling issues including footer
- Footer is not aligned (loads in middle of the page)
- Font styles are not matched
- Content loading on Left from second page
image.png (64.7 KB)
We are stuck on here. .
I have attached a another package (150.9 KB)
including HTML file and generated Pdf.
Appreciate if you can help us soon.
Please let me know if you nee anymore information on this.
We have already investigated this behavior in the output PDF and found it as not a Bug in the API. You can please use any browser to view and print HTML file as PDF to see that the Footer is rendered at the same location where it is in the PDF generated by the API.
Could you please share the screenshot for this issue as well so that we can further proceed accordingly.
We have noticed this issue at our end and have logged it as PDFNET-49396 in our issue tracking system. We will further investigate it in details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.