当前代码如下:【运行之后得到的文本是全部在一行,有没有办法修正如下代码,实现文本段落格式和原pdf格式一样呢?】
Dim t1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim reader As New iTextSharp.text.pdf.PdfReader("D:\2021工作资料\会议须知.pdf")
Dim n As Integer = reader.NumberOfPages
Dim str As String = ""
For i As Integer = 1 To n
Dim strategy As object = New iTextSharp.text.pdf.parser.SimpleTextExtractionStrategy()
Dim currentText As String = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(Reader, i, strategy)
currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.[Default], Encoding.UTF8, Encoding.[Default].GetBytes(currentText)))
str &= currentText
Next
output.show(str)
reader.Close()
t1.text=str
所需引用的dll
[此贴子已经被作者于2022/2/21 18:02:04编辑过]