ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Error: Using operand of type iTextSharp.txt.pdf.PdfStamper must implement System.IDisposable in ASP.Net<p>Hi <a class="username" rel="simonoldma"> simonoldma</a>,</p> <p>Will you please let me know which version of dll you are using.</p>http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/Wed, 28 Dec 2016 03:32:44 GMTError: Using operand of type iTextSharp.txt.pdf.PdfStamper must implement System.IDisposable in ASP.Net<p>Hi <a class="username" rel="simonoldma"> simonoldma</a>,</p> <p>Change with the below code and check.</p> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">protected void AddPageNumber(object sender, EventArgs e) { byte[] bytes = File.ReadAllBytes(Server.MapPath(&#34;~/PDF/Test.pdf&#34;)); Font blackFont = FontFactory.GetFont(&#34;Arial&#34;, 12, Font.NORMAL, BaseColor.BLACK); using (MemoryStream stream = new MemoryStream()) { PdfReader reader = new PdfReader(bytes); PdfStamper stamper = new PdfStamper(reader, stream); int pages = reader.NumberOfPages; for (int i = 1; i &lt;= pages; i++) { ColumnText.ShowTextAligned(stamper.GetUnderContent(i), Element.ALIGN_RIGHT, new Phrase(i.ToString(), blackFont), 568f, 15f, 0); } stamper.Close(); stamper.Dispose(); bytes = stream.ToArray(); } File.WriteAllBytes(Server.MapPath(&#34;~/PDF/Test1.pdf&#34;), bytes); }</pre> <p><span style="text-decoration: underline;">VB.Net</span></p> <pre class="brush: vb">Protected Sub AddPageNumber(sender As Object, e As EventArgs) Dim bytes As Byte() = File.ReadAllBytes(Server.MapPath(&#34;~/PDF/Test.pdf&#34;)) Dim blackFont As Font = FontFactory.GetFont(&#34;Arial&#34;, 12, Font.NORMAL, BaseColor.BLACK) Using stream As New MemoryStream() Dim reader As New PdfReader(bytes) Dim stamper As New PdfStamper(reader, stream) Dim pages As Integer = reader.NumberOfPages For i As Integer = 1 To pages ColumnText.ShowTextAligned(stamper.GetUnderContent(i), Element.ALIGN_RIGHT, New Phrase(i.ToString(), blackFont), 568.0F, 15.0F, 0) Next stamper.Close() stamper.Dispose() bytes = stream.ToArray() End Using File.WriteAllBytes(Server.MapPath(&#34;~/PDF/Test1.pdf&#34;), bytes) End Sub</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/Wed, 28 Dec 2016 04:04:22 GMTError: Using operand of type iTextSharp.txt.pdf.PdfStamper must implement System.IDisposable in ASP.Net<p>The code&nbsp;worked.&nbsp; Thank you. Must admit that ASPFORUMS is the best in the world!&nbsp; Simon M.</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/Wed, 28 Dec 2016 12:52:02 GMTError: Using operand of type iTextSharp.txt.pdf.PdfStamper must implement System.IDisposable in ASP.Net<p>Not certain which version is.&nbsp; But as I know it is not too old.&nbsp; was downloaded in 2016.&nbsp; I got the help from <strong>dharmend</strong>r&nbsp; and do not have problems with code.</p>http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/http://www.aspforums.net/Threads/378840/Error-Using-operand-of-type-iTextSharptxtpdfPdfStamper-must-implement-SystemIDisposable-in-ASPNet/Wed, 28 Dec 2016 12:54:54 GMT