The following code produces
"An unhandled exception of type 'System.IO.IOException' occurred in microsoft.visualbasic.dll
Additional information: The process cannot access the file "C:\Temp\Smith.pdf" because it is being used by another process."
The Code:
Dim form As Form = New Form("C:\Temp\ATemp.pdf", "C:\Temp\Smith.pdf")
Dim pdfv As New PdfViewer
form.FillField("Name", "Bob Smith")
form.Save()
pdfv.OpenPdfFile("C:\Temp\Smith.pdf")
Dim prs As New System.Drawing.Printing.PrinterSettings
Dim pgs As New System.Drawing.Printing.PageSettings
prs.Duplex = Duplex.Vertical
pgs.Margins.Bottom = 50
pgs.Margins.Top = 50
pgs.Margins.Left = 50
pgs.Margins.Right = 50
pgs.PaperSize = New System.Drawing.Printing.PaperSize("Custom", 800, 1050)
pdfv.PrintDocumentWithSettings(pgs, prs)
pdfv.ClosePdfFile()
Kill("C:\TempBIPDF\Smith.pdf")
The error occurs at the "Kill" line. Is there another way to close the file?
Thanks,
Jeff