Problem in reading pdf file?
-
Hello all, I wand to read a pdf file using asp .Net and want to show contents of pdf file into a text area. Get a lots of code for viewing pdf file or writing the pdf file but not for how to read a pdf file. Please help me...
Well I figured out a way to do it, but it requires that you have the full version of Adobe installed on your PC so that you can gain access to the Adobe APIs (which doesn't technically qualify as a free way to do it). Here is the code I used to read the contents of a PDF. You will have to add a reference to the Adobe APIs in your project: Dim objPDFPage As AcroPDPage Dim objPDFDoc As New AcroPDDoc Dim objPDFAVDoc As AcroAVDoc Dim objAcroApp As AcroApp Dim objPDFRectTemp As Object Dim objPDFRect As New AcroRect Dim lngTextRangeCount As Long Dim objPDFTextSelection As AcroPDTextSelect Dim temptextcount As Long Dim strText As String Dim lngPageCount As Long Dim Fora As Long objPDFDoc.Open(tbdocdisplaypath.Text) lngPageCount = objPDFDoc.GetNumPages For Fora = 0 To lngPageCount - 1 objPDFPage = objPDFDoc.AcquirePage(Fora) objPDFRectTemp = objPDFPage.GetSize objPDFRect.Left = 0 objPDFRect.right = objPDFRectTemp.x objPDFRect.Top = objPDFRectTemp.y objPDFRect.bottom = 0 ' objPDFTextSelection = objPDFDoc.CreateTextSelect(lngPageCount, objPDFRect) objPDFTextSelection = objPDFDoc.CreateTextSelect(Fora, objPDFRect) ' Get The Text Of The Range temptextcount = objPDFTextSelection.GetNumText For lngTextRangeCount = 1 To objPDFTextSelection.GetNumText doctext = doctext & objPDFTextSelection.GetText(lngTextRangeCount - 1) Next doctext = doctext & vbCrLf Next doctype = "PDF" objPDFDoc.Close() --------------------------------------------- Alernatively, you can browse these links and try helping yourself http://www.componentsource.com/relevance/pdf/components/index.html?q=pdf+visual http://groups.google.com/group/microsoft.public.dotnet.languages.vb.data/browse\_thread/thread/99a3fbc1608f396e/236c45f7cf2713b5%23236c45f7cf2713b5