2

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

Aspose growing file size screenshot

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

Timothy Khouri
  • 31,315
  • 21
  • 88
  • 128

1 Answers1

2

The output file size increases with each iteration because you're using the component in evaluation mode. When working in evaluation mode, it adds evaluation watermarks in the PDF file. Moreover, in evaluation mode, component is little slower too due to the evaluation checks and watermarks etc.

Please use the component with the license file. If you're just evaluating then you may get a temporary license for 30 days to test the application without any such limitations.

Also, please make sure that you're using the latest version of the component -- Aspose.Pdf for .NET 6.3.0.

If you still find any further questions or issues, please share with us.

I have also added a snapshot of the output received at my end with the license file:

Output with Licensed Version

Disclosure: I work as a developer evangelist at Aspose.

Shahzad Latif
  • 1,408
  • 12
  • 29