我有这个代码来分割我在Web应用程序中使用的pdf文件。它适用于1000页,因为它在分割1000页后返回一个网页。但我有pdf包含6000页,分割PDF页面需要花费更多时间,而不是用1000页分割PDF。由于浏览器超时,我得到“网页不可用”。
我可以做些什么来保持连接活着?
Public Sub splitandsave(ByVal inputpath As String, ByVal outputpath As String)
obj1.getconn()
obj1.cn.Open()
Dim file As FileInfo = New FileInfo(inputpath)
Dim name As String = file.Name.Substring(0, file.Name.LastIndexOf("."))
Using reader As PdfReader = New PdfReader(inputpath)
Dim pagenumber As Integer
For pagenumber = 1 To reader.NumberOfPages
Dim email As String
Dim da As New SqlDataAdapter("select * from commondetailmaster where email!='-' order by formno", obj1.cn)
Dim ds As New DataSet
da.Fill(ds)
email = ds.Tables(0).Rows(pagenumber)("formNo").ToString
Dim quota1 As String
quota1 = "'"
Dim filename As String = quota1 & email.ToString() & quota1 & ".pdf"
Dim document As Document = New Document()
Dim copy As PdfCopy = New PdfCopy(document, New FileStream(outputpath & "\\" & filename, FileMode.Create))
document.Open()
copy.AddPage(copy.GetImportedPage(reader, pagenumber))
document.Close()
Next
End Using
End Sub