I am looking for some (preferably free) library that can help extract PDF text from a specified rectangular region which is specified by left, top, width and height parameters. It should be usable with PHP on a linux system. Could you please suggest such a library and a working example?
Is there any library to help extract text from pdf from a rectangular region that can be used with PHP
2.5k views Asked by Raouf Athar At
1
There are 1 answers
Related Questions in PHP
- How to add the dynamic new rows from my registration form in my database?
- Issue in payment form gateway
- How to create a facet for WP gridbuilder that displays both parent and child custom fields?
- Function in anonymous Laravel Blade component
- How to change woocomerce or full wordpress currency with value from USD to AUD
- General questions about creating a custom theme Moodle CMS
- How to add logging to an abstract class in php
- error 500 on IIS FastCGI but no clue despite multiple error loggings activated
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- How to isolate PHP apps from each other on a local machine(Windows or Linux)?
- Laravel: Using belongsToMany relationship with MongoDB
- window.location.href redirects but is causing problems on the webpage
- Key provided is shorter than 256 bits, only 64 bits provided
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
Related Questions in PDF
- How to use custom font during html to pdf conversion?
- How to get content of BLOCK types LAYOUT_TITLE, LAYOUT_SECTION_HEADER and LAYOUT_xx in Textract
- PDF form checkbox/radio button ignores content stream
- Suggest python library for rendering html to pdf files
- Problems with the order in which PDF files are created
- Centering a map element on a generated PDF
- download all pdf files from website doesn't support wildcard
- How to enter external pdf into quarto book while keeping page layout+numbering
- How do I create a website that combines user input and standard text and converts it into a pdf?
- Excel VBA error 1004 on PDF export - not a path issue
- downloading pdf using requests not working
- Creating pdf on Firestore with Pdfplum: Template path "no such object"
- Export password protected PDF from QGIS
- XPS convert PDF with Ghostscript
- Download PDF in ASP.NET MVC application
Related Questions in PDFTOTEXT
- How to extract text from pdf with complex layouts using python?
- Gscript PDF to text by OCR, problem with some characters
- How can I extract text from a PDF document in a Flutter app?
- How to get the specific coordinates of each contents in PDF file?
- Http request convertio api
- Python: Unable to extract multi-line 'Property Address' from PDF
- pdf to text reading from different file
- How to convert 2 column pdf data text to single column
- Cannot convert Hebrew characters using pdftotext
- Having trouble installing pdftotext on Windows
- Parsing data from pdftotext .txt file output using VBA
- Error while pdf to text conversion using textract
- I can't get PDF document file path with PHP-XPDF
- is there any way to extract content of pdf header and footer using pypdf2 or any other tool
- Textract - windows10 - shell error - failed with exit code 127
Related Questions in PDF-TO-HTML
- how do i use the pdf2html docker image on windows to convert pdf to html?
- want to extract information from pdf with table
- Convert PDF to HTML using python and pdfkit
- How to install poppler-utils on godaddy server without ssh
- I am converting PDF to html using gufy/pdf-to-html package on GitHub . But it showing error that: Undefined array key "pages"
- Arial font not working on PDF file on ubuntu
- Upgrade from iText 5 to iText 7 pdftohtml, keep all fonts same
- Poppler Utils pdftohtml Turkish Character problem
- Using co-ordinates in XML generated by poppler to build an email template
- I am using PHP Chrome HTML 2 PDF but unable to use Header and Footer in the PDF
- How to convert pdf to HTML using python pdfminer?
- Choose encoding for pdftohtml
- PDF to HTML converter - Stuck
- Write output of pdftohtml to stdout
- Decreasing size of PDF when using puppeteer for pdf generation
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Commandline
PHP can use external commandline tools as well. So if this is an option for you...
If you use the commandline
pdftotext-- but only the Poppler version, not the XPDF version! -- you have these optional CLI parameters:A working example:
First, let's create a PDF from the Bash man page, using Ghostscript:
Next, let's extract some text from it. Use a width 200, a height of 100, and the top left corner at
(200,200){you calculate here from the top left as being positioned at(0,0)}:Note my usage of
-f(for f irst page) and-l(for l ast page). If you don't use this,pdftotextwill print the respective text region for every single page of a multi-page PDF.Compare to this screenshot:
Looks like it worked as expected, no?
Library
Poppler
Poppler can also be used as a library. But I do not have any experience with this approach (nor much with PHP).
TET
If you cannot find a free library which fullfills your requirements, then hava a look at the best thing for text extraction from PDFs: TET, the text extraction toolkit. TET is part of the PDFlib.com family of products.
PDFlib.com is Thomas Merz's company. In case you don't recognize his name: Thomas Merz is one of the authors of the "PostScript and PDF Bible".
TET's first incarnation is a library. That one can probably do everything you ever wanted, including positional information about every element on the page.
pdflib.com also offers another incarnation of this technology, the TET plugin for Acrobat. And the third incarnation is the PDFlib TET iFilter. This is a standalone tool for Windows desktops. Both these are free (as in beer) to use for private, non-commercial purposes.
TET is way better than Adobe's own text extraction. It extracted text for me where other tools (including Adobe's) did spit out garbage only.
Give it a try.