473,503 Members | 8,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can we Read the text contents from PDF using .net

Can we Read the text contents from PDF using .net.

If possible means what to do.
Sep 14 '06 #1
4 2481
=?Utf-8?B?Qi5OLlByYWJodQ==?= <pr******@officetiger.comwrote in
news:1D**********************************@microsof t.com:
Can we Read the text contents from PDF using .net.

If possible means what to do.
PDF is a collection of objects - it's not formatted text.

So you cna read the text - tho maybe not in a meaningful manner
Sep 14 '06 #2
Here is what I do:

''' <summary>
''' Gets the PDF text from a file
''' requires pdftotext.exe from http://www.foolabs.com/xpdf
''' </summary>
''' <param name="filename">The filename.</param>
''' <returns>PDF Text</returns>
Public Function getPDFtext(ByVal filename As String) As String
Dim p As New System.Diagnostics.Process
Dim std_out As IO.StreamReader
Dim txtStdout As String = ""

Try

p.StartInfo.FileName = "Asset Search\pdftotext.exe"
p.StartInfo.Arguments = filename & " -"
p.StartInfo.UseShellExecute = False
p.StartInfo.CreateNoWindow = True
p.StartInfo.RedirectStandardOutput = True

p.Start()
std_out = p.StandardOutput()

'Get the text from standard output
txtStdout = std_out.ReadToEnd()

std_out.Close()
Catch ex As Exception
MsgBox("Error in while extracting PDF text, the error is: " &
ex.Message.ToString)
End Try

Return txtStdout
End Function

I wouldn't use it for anything serious, business critical, or Realtime. For
that you should probably go with a commercial control like
http://www.pdfonline.com/. But for quick and dirty text extraction it works
fine for me.

Best Regards,

Chris
"B.N.Prabhu" <pr******@officetiger.comwrote in message
news:1D**********************************@microsof t.com...
Can we Read the text contents from PDF using .net.

If possible means what to do.

Sep 15 '06 #3
Just to clarify the following line should point the the actual pdftotext.exe
program

p.StartInfo.FileName = "Asset Search\pdftotext.exe" <---Points to location
of pdftotext.exe

Chris

"Chris" <co***********@nospam.yahoo.comwrote in message
news:ec**************@TK2MSFTNGP06.phx.gbl...
Here is what I do:

''' <summary>
''' Gets the PDF text from a file
''' requires pdftotext.exe from http://www.foolabs.com/xpdf
''' </summary>
''' <param name="filename">The filename.</param>
''' <returns>PDF Text</returns>
Public Function getPDFtext(ByVal filename As String) As String
Dim p As New System.Diagnostics.Process
Dim std_out As IO.StreamReader
Dim txtStdout As String = ""

Try

p.StartInfo.FileName = "Asset Search\pdftotext.exe"
p.StartInfo.Arguments = filename & " -"
p.StartInfo.UseShellExecute = False
p.StartInfo.CreateNoWindow = True
p.StartInfo.RedirectStandardOutput = True

p.Start()
std_out = p.StandardOutput()

'Get the text from standard output
txtStdout = std_out.ReadToEnd()

std_out.Close()
Catch ex As Exception
MsgBox("Error in while extracting PDF text, the error is: " &
ex.Message.ToString)
End Try

Return txtStdout
End Function

I wouldn't use it for anything serious, business critical, or Realtime.
For that you should probably go with a commercial control like
http://www.pdfonline.com/. But for quick and dirty text extraction it
works fine for me.

Best Regards,

Chris
"B.N.Prabhu" <pr******@officetiger.comwrote in message
news:1D**********************************@microsof t.com...
>Can we Read the text contents from PDF using .net.

If possible means what to do.


Sep 15 '06 #4
If you want to pull information in some type of format my advice is to
purchase some sdk software (suggestions: OmniPage or ABBYY). The
software will allow you to extract information or images from a pdf. I
have never used the sdk kit however I have used the software and it
does extremely well when we use it to extract data from a pdf and
export it as an excel file.

Sep 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1404
by: ashton | last post by:
Hello, I have a file (mytest.fle) it is just a text file with a different extension. I would like to be able to open this file through my C++ application and read it in as a string. For...
4
2711
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void...
8
7242
by: james | last post by:
I am trying to use Filestream to read a file ( .DAT) that contains values in HEX that I want to convert to text. I know the different offset addresses for each portion of the data I am trying to...
6
27458
by: Jim S | last post by:
I have a need to read the contents of an html table on a remote web page into a variable. I guess this is called screen scraping but not sure. I'm not sure where to start or what the best...
4
4183
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
7
3067
by: Hallvard B Furuseth | last post by:
I'm trying to clean up a program which does arithmetic on text file positions, and also reads text files in binary mode. I can't easily get rid of it all, so I'm wondering which of the following...
9
4256
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to...
3
2925
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT...
6
2906
ak1dnar
by: ak1dnar | last post by:
Hi, I have created Sub in VB.net application, Which reads a text file contents. Sub IPsetter() Dim fileName As String Dim realIParray As String() = Nothing Dim...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.