Hello, I am trying to add text to the bottom of every page of a Pdf.Document with
Page.AddStamp(). The code below worked fine on my last version of Aspose.PDF (6.5).
However, on the latest version, it passes through the foreach once and throws an
ObjectDisposedException on the second pass. It claims that the stream for the Pdf,
I assume, is closed. It appears that AddStamp is closing the stream. Any suggestions?
Any help is greatly appreciated!
private void AddCustomerStamp(string customer)
{
TextStamp customerStamp = <span style="color:blue;">new</span> TextStamp(customer);
customerStamp.HorizontalAlignment = HorizontalAlignment.Left;
customerStamp.LeftMargin = Footer.LeftMargin;
customerStamp.VerticalAlignment = VerticalAlignment.Bottom;
customerStamp.BottomMargin = Footer.BottomMargin;
<span style="color:blue;">foreach</span> (Page p <span style="color:blue;">in</span> <span style="color:blue;">this</span>.document.Pages)
{
p.AddStamp(customerStamp);
}
}</pre>
Hi Sfarley,
Thanks for using our products and sharing the sample source code.
I tested the scenario with your sample source code using Aspose.Pdf for .NET v6.9 and unable to find any issue. Resultant PDF document is attached for your reference. Kindly try to use the latest version Aspose.Pdf for .NET v6.9 and check if it fits your need. If you still face any problem kindly create a sample application along with template document and post here to show us the issue. This will help us to regenerate the issue and get the cause of the issue soon.
We apologize for your inconvenience.
Thanks & Regards,
Sorry for the late reply. I tried to make a sample solution but was unable to reproduce my error.
I was able to get my application working by remaining on an old version of Aspose.PDF and upgrading the rest of components.
Hi Sfarley,
Thanks for your feedback.
sfarley2:
I was able to get my application working by remaining on an old version of Aspose.PDF and upgrading the rest of components.
As you mentioned in your previous post you are using Aspose.Pdf for .NET v6.5 but we recommend you to try the latest version of Aspose.Pdf for .NET v6.9 and check if it works fine for you. If you still face any issue with latest version kindly share a sample application with us so that we could test the scenario at our end and get to the cause of the issue. Actually, without replicating the issue at our end we will not be able to raise the ticket for resolution.
We apologize for your inconvenience.
Thanks & Regards,