My question is if you can delete right after stamper.Close(). Paulo
----- Original Message ----- From: "Kevin Blackwell" <akblack...@gmail.com> To: "Post all your questions about iText here" <itext-questions@lists.sourceforge.net> Sent: Sunday, October 18, 2009 6:09 PM Subject: Re: [iText-questions] deleting a pdf after creating Paulo, Thanks for the comments, But still wont let me delete. I missed a line when posting, but I added stamper.Close() But I still get Dim FormFile As String = "form.pdf" Dim outFile As String = "Out.pdf" Dim reader As New PdfReader(FormFile) Dim Fstream As FileStream = New FileStream(outFile, FileMode.Create) Dim stamper As New PdfStamper(reader, Fstream)Dim pdfFormFields As AcroFields = stamper.AcroFields pdfFormFields.SetField("contractno", contractno.Text) reader.Close() stamper.Close() blah blah blah Try Dim SendFrom As MailAddress = New MailAddress("someaddress@") Dim sendTo As MailAddress = New MailAddress("Someaddress@") Dim MyMessage As MailMessage = New MailMessage(SendFrom, sendTo) MyMessage.Subject = "Attached PDF " Dim attachFile As New Attachment("Out.pdf") MyMessage.Attachments.Add(attachFile) Dim mailClient As SmtpClient = New SmtpClient MyMessage.IsBodyHtml = False mailClient.Host = "mail.com" mailClient.Port = "25" mailClient.Credentials = New Net.NetworkCredential("fromaddress", "Password") mailClient.Send(MyMessage) Dim fileinfo As FileInfo = New FileInfo("Out.pdf") Fstream.Close() If Not Fstream Is Nothing Then Fstream.Dispose() Fstream = Nothing End If If fileinfo.Exists Then File.Delete("Out.pdf") End If Catch ex As Exception Response.Write(ex.ToString) End Try System.IO.IOException: The process cannot access the file 'Out.pdf' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.Delete(String path) at Test.Button1_Click(Object sender, EventArgs e) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/