以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  读取pdf  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=149382)

--  作者:jsq96jg
--  发布时间:2020/4/30 9:35:00
--  读取pdf

Dim reader As New iTextSharp.text.pdf.PdfReader("d:\\test.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) 

messagebox.show(currenttext)   
    currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.[Default], Encoding.UTF8, Encoding.[Default].GetBytes(currentText)))

messagebox.show(currenttext)   
    str &= currentText    
Next
msgbox(str)
reader.Close()



messagebox.show()显示啥也没有,不知道为什么?


--  作者:有点蓝
--  发布时间:2020/4/30 10:23:00
--  
做个例子以及相关的dll一起发上来测试,我这边没有运行环境