Hi, we need to convert some html files into pdfs and add headers and footers to every pdf page , but we seemed to have encountered a few problems.
Regarding Aspose convert from html to pdf there seems to be some issues. First the Aspose version 9.9 was used, but even after the update to 10.1.0 the same issues appeared.
1) We used Aspose.Pdf.Document class with code example from http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format
to load a stream into the pdf, but the third line of the code below give an error Value cannot be null. Parameter name: path1
HtmlLoadOptions options = new HtmlLoadOptions(basePath);
MemoryStream stream1 = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(content.Content));
Document pdfDocument = new Document(stream1, options);
My question in this case is how can we load an html string without getting the error. Can you provide help on why that error appears.
2) The second approach was to use Aspose.Pdf.Generator.Pdf class, but the problem is that there is no formatting of the text, all text appears same size and too big for a page
Aspose.Pdf.Generator.Pdf pdf = new Pdf();
// specify the Character encoding for for HTML file
pdf.HtmlInfo.CharSet = "UTF-8";
pdf.HtmlInfo.CharsetApplyingLevelOfForce = HtmlInfo.CharsetApplyingForceLevel.UseWhenImpossibleDetectFromContent;
pdf.BindHTML(stream, basePath);
using (MemoryStream ms = new MemoryStream())
{
pdf.Save(ms);
return ms.ToArray();
}
My opinion is that css is not loading, but I’m not sure. Do you have some insights that might help us with this?
3) I’ve also read that there is no support for floating css this was used for footer when some text needs to be aligned to left and some to right. Is there another way to accomplish this with Aspose?
Could you help us with,
Thanks in advance