I’m using this simple code
Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions(ResourcesDirectoryPath);
var document = new Aspose.Pdf.Document(htmlFilePath, htmlLoadOptions);
document.Save(filePath); // .pdf file
Works like a charm everywhere except Acrobat Reader, it cannot open it because file is corrupt.
I also tried do file saving through memory stream:
using (var ms = new MemoryStream())
{
document.Save(ms, SaveFormat.Pdf);
using (FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
ms.Flush();
var bytes = ms.ToArray();
file.Write(bytes, 0, bytes.Length);
file.Close();
ms.Close();
}
}
with the same result.
We are using Aspose.PDF 18.7, but it looks like owners of later versions struggling with the same issue.
Any hint or help would be appreciated.