Hi Aspose Team,
Upon converting files from latest version of Aspose for text, we have noticed a sudden and significant increase in file size w.r.t older version of Aspose(21.7.0).
This unexpected behavior is causing concerns for us as it impacts the efficiency of our processes and the overall storage requirements for our files.
We would appreciate it if you could provide us with some insights into why this might be happening and if there are any recommended solutions or workarounds to mitigate the file size increase during conversions.
Code Used
using (TextReader tr = new StreamReader(inputPath))
{
using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document())
{
Aspose.Pdf.Page page = pdfDocument.Pages.Add();
page.PageInfo.DefaultTextState.Font = FontRepository.FindFont(“Arial”);
page.PageInfo.DefaultTextState.FontSize = 8;
page.PageInfo.Width = Aspose.Pdf.PageSize.PageLetter.Width;
page.PageInfo.Height = Aspose.Pdf.PageSize.PageLetter.Height;
page.PageInfo.Margin.Left = 70;
page.PageInfo.Margin.Right = 70;
page.PageInfo.DefaultTextState.LineSpacing = 1;
Aspose.Pdf.Text.TextFragment text = new Aspose.Pdf.Text.TextFragment(tr.ReadToEnd());
page.Paragraphs.Add(text);
Aspose.Pdf.Optimization.OptimizationOptions optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions
{
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
LinkDuplcateStreams = true,
AllowReusePageContent = true
};
pdfDocument.OptimizeResources(optimizationOptions);
pdfDocument.Save(outputPath);
}
}