The following code reads a text file and it displays the content.
Is it possible to read and display a pdf file as a string?
Code:
Dim s As String
Dim fileName As String
fileName = "test.txt"
Dim stream As IO.StreamReader
stream = New IO.StreamReader(fileName)
s = stream.ReadToEnd().ToString
Response.Write(s)
There is something called an IFilter that can be used to read most text based files, office documents, some PDFs, images, etc.
IFilters are either installed with the OS or get installed with software. For example, MS Office Pro 2003 installs an IFilter to OCR tiff images and return the text.
As for a PDF, a PDF can be composed of images and text. Usually PDFs created directly from productivity software like MS Office, Open Office, etc. are composed of text and can readily be parsed using an IFilter. However some PDFs are composed of strictly images, scanned documents for example. These can't be easily parsed.
There may be other ways, but maybe this will help.
Bookmarks