{"action":"created","issue":{"url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/231","labels_url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/231/comments","events_url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/231/events","html_url":"https://github.com/mstamy2/PyPDF2/issues/231","id":111331294,"number":231,"title":"Unable to identify the tables","user":{"login":"bonsonsm","id":4316655,"avatar_url":"https://avatars.githubusercontent.com/u/4316655?v=3","gravatar_id":"","url":"https://api.github.com/users/bonsonsm","html_url":"https://github.com/bonsonsm","followers_url":"https://api.github.com/users/bonsonsm/followers","following_url":"https://api.github.com/users/bonsonsm/following{/other_user}","gists_url":"https://api.github.com/users/bonsonsm/gists{/gist_id}","starred_url":"https://api.github.com/users/bonsonsm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonsonsm/subscriptions","organizations_url":"https://api.github.com/users/bonsonsm/orgs","repos_url":"https://api.github.com/users/bonsonsm/repos","events_url":"https://api.github.com/users/bonsonsm/events{/privacy}","received_events_url":"https://api.github.com/users/bonsonsm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-14T06:11:26Z","updated_at":"2016-01-04T21:13:12Z","closed_at":null,"body":"Hello,\r\nI am converting a pdf file into a text file. In the extracted text file, I am unable to know where the table starts, however I am able to extract the text of the table as is, but I want to know where the table starts and ends so I could do some post processing on it.\r\n\r\nBelow is my code:\r\n\r\ndef extractTextFromPDF(strDownloadDirectory, fileName, txtFilePath):\r\n        filePathName = strDownloadDirectory + fileName\r\n        pdfFileObj = open(filePathName, 'rb')\r\n        pdfReader = PyPDF2.PdfFileReader(pdfFileObj)\r\n        intPages = pdfReader.getNumPages()\r\n        print(intPages)\r\n        strText = ''\r\n        print(fileName)\r\n        fileName =fileName[0:len(fileName)-4]\r\n        txtFilePath = txtFilePath +fileName  + '.txt'\r\n        target_file = open(txtFilePath, \"w\" , encoding='utf-8')\r\n        for i in range(0,intPages):\r\n            objPDFObj = pdfReader.getPage(i)\r\n            strText =  objPDFObj.extractText().rstrip()\r\n            strText = \" \".join(strText.replace(u\"\\xa0\", \" \").strip().split())\r\n            print(strText)\r\n\t    target_file.write(strText)\r\n\t    target_file.close()\r\n\r\nKindly suggest.\r\n"},"comment":{"url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/comments/168810469","html_url":"https://github.com/mstamy2/PyPDF2/issues/231#issuecomment-168810469","issue_url":"https://api.github.com/repos/mstamy2/PyPDF2/issues/231","id":168810469,"user":{"login":"mstamy2","id":3945030,"avatar_url":"https://avatars.githubusercontent.com/u/3945030?v=3","gravatar_id":"","url":"https://api.github.com/users/mstamy2","html_url":"https://github.com/mstamy2","followers_url":"https://api.github.com/users/mstamy2/followers","following_url":"https://api.github.com/users/mstamy2/following{/other_user}","gists_url":"https://api.github.com/users/mstamy2/gists{/gist_id}","starred_url":"https://api.github.com/users/mstamy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstamy2/subscriptions","organizations_url":"https://api.github.com/users/mstamy2/orgs","repos_url":"https://api.github.com/users/mstamy2/repos","events_url":"https://api.github.com/users/mstamy2/events{/privacy}","received_events_url":"https://api.github.com/users/mstamy2/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T21:13:12Z","updated_at":"2016-01-04T21:13:12Z","body":"PyPDF2's text extraction capabilities are somewhat primitive at the moment, though I want to make enhancing them a priority.\r\n\r\nConsider [PDFMiner](http://www.unixuser.org/~euske/python/pdfminer/) or [PDFbox](https://pdfbox.apache.org/) for your immediate needs; they feature much more sophisticated text extraction resources.\r\n\r\nIt's not simple to recognize a table structure in PDF, but these libraries might be able to help."}}