I'm evaluating Aspose.Net - so far it's great for my needs. (ITextSharp, PDFOne, CLPrint, Adobe and ABCPdf (WebSupergoo) did not meet my needs - not the point of this question, so please don't answer with "have you tried X yet?")
I want to load a PDF from file once, then in a loop, set some form fields, then save it. Works great, except I noticed the file size constantly growing. I figured it was due to the form fields, but this isn't the case... notice this disturbing code and result:
The Code
static void Main(string[] args)
{
var form = new Aspose.Pdf.Facades.Form(@"c:\test.pdf");
for (int i = 0; i < 100; i++)
{
using (var tempStream = new MemoryStream())
{
form.DestStream = tempStream;
form.Save();
Console.WriteLine("Size: " + tempStream.Length);
}
}
}
The Disturbing Result
Have any of you used Aspose to load a PDF once, and then save it multiple times, and somehow overcame the growing file-size issue?
P.S. - If I re-new-up the object every time, the file size stays low, but that's slower