joecool2005 Posted August 6, 2007 Share Posted August 6, 2007 Hi,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? 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) Thx! Link to comment Share on other sites More sharing options...
aspnetguy Posted August 6, 2007 Share Posted August 6, 2007 read this http://www.developer.be/forums/index.cfm/f.../forumID/11.htminstead of creating the new pdf file like the example above does try converting the byte array to a string and see what that gives you. Link to comment Share on other sites More sharing options...
joecool2005 Posted August 6, 2007 Author Share Posted August 6, 2007 Thanks for your help!How can I display the content as string? It showed me numbers Dim ReadPdf As New IO.FileStream("D:\test.pdf", IO.FileMode.Open) Dim FileSize As Long = ReadPdf.Length Dim Buffer(FileSize) As Byte ReadPdf.Read(Buffer, 0, Buffer.Length) ReadPdf.Close() 'I don't know how to display the content as string Dim i As Integer For i = 0 To Buffer.Length - 1 Response.Write(Buffer(i).ToString) Next Thx Link to comment Share on other sites More sharing options...
aspnetguy Posted August 6, 2007 Share Posted August 6, 2007 I thought that might be too easy :)This article exaplians the whole process using some 3rd party librarieshttp://www.codeproject.com/cs/samples/pdf2text.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.