У меня есть веб-страница aspx, которая получает параметры в виде строки запроса, и я хотел открыть эту страницу, прочитать строки и экспортировать ее в формате PDF, я использую следующий код, но, похоже, он не работает
Dim strpath As String = Server.MapPath("pagename.aspx?id=0000")
Dim sr As StreamReader = New StreamReader(strpath, False)
Dim line As String
line = sr.ReadToEnd
sr.Close()
' Code to convert to pdf
'Dim doc As New Document(PageSize.LETTER, 80, 50, 30, 65)
Dim fsNew As New StringReader(line)
Dim doc As New Document(PageSize.A4, 80, 50, 30, 65)
Dim Styles As New StyleSheet()
'stryle.LoadTagStyle("ol", "16,0")
Using fs As New FileStream("newpdf.pdf", FileMode.Create)
PdfWriter.GetInstance(doc, fs)
Using stringReader As New StringReader(line)
Dim parsedList = HTMLWorker.ParseToList(stringReader, Styles)
doc.Open()
' parse each html object and add it to the pdf document
For Each item As Object In parsedList
doc.Add(DirectCast(item, IElement))
Next
doc.Close()
End Using
End Using