Hi ,
I have 150 KB html file and we want to generate pdf and get pdf bytes , but its very slow to creating Document class and increasing the document size (150KB to 340 KB) after converting to PDF.
i have another scenario another html tags to converting to PDF but just only “<p>Hello World</p>
” and converting to pdf.The output pdf size is 28 KB.
I think it’s so high.
So how can i manage with this ?
Thank you , best regards.
[C#]
string html = "<p>Hello World!</p>";
byte[] bytes = UTF8Encoding.UTF8.GetBytes(html);
HtmlLoadOptions options = new HtmlLoadOptions();
Document document = new Document(new MemoryStream(bytes), options);
Aspose.Pdf.Optimization.OptimizationOptions optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions
{
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,.
AllowReusePageContent = true,
};
document.OptimizeResources(optimizationOptions);
MemoryStream memoryStream = new MemoryStream();
document.Save(memoryStream, SaveFormat.Pdf);
document.Save(@"C:\pdfFiles\fksp5.pdf");