We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Read printed PDF

Hi Syncfusion team,

I would like to read the content from PDF fields on PDFs which were printed as PDF. In another words, I do not have problem reading the PDF fields when they are editable. Once the entire file is printed, all fields become read-only. I cannot find a way to read those fields at that time. 


Could you please let me know how could I read those fields? In the example attached, I would like to read(extract) the field with the content "John"


T


PdfDocument document = PdfDocument(inputBytes: file.readAsBytesSync());
final PdfField field = document.form.fields[0];

_text = (field as PdfTextBoxField).text; // this works when fields are editable.
_text = PdfTextExtractor(document).extractText(); // this reads everything when PDF is printed with the exception of fields

Attachment: examples_6bff14dc.zip

4 Replies 1 reply marked as answer

IJ Irfana Jaffer Sadhik Syncfusion Team March 23, 2023 06:32 AM UTC

After examining the given document, we discovered that one of the printed documents (I cannot read the fields) has been flattened, which means that the editable Acroform fields have been removed and replaced with graphical representations of the field values. As a result, extracting text from the flattened field is not possible. However, you can utilize our extract text option as described in the following user guide documentation to obtain all the text from the PDF document.

https://help.syncfusion.com/flutter/pdf/working-with-text-extraction#working-with-the-basic-text-extraction




TV Thiago Valente Aguiar March 27, 2023 06:13 PM UTC

Thank you for the quick response.

So is it correct to say that it is never possible to extract the text from a flattened field using Syncfusion? The extract text option you mentioned would extract all text with the exception of the flattened field.


Appreciate your time.



IJ Irfana Jaffer Sadhik Syncfusion Team March 28, 2023 07:25 AM UTC

On further analysis, we have confirmed that the provided PDF file "I cannot read the fields.pdf" contains no readable text data in its content structure. This PDF contains embedded path data in its content structure for preservation.

 

As of now, it is not possible to extract text in this type of flattened PDF using our Syncfusion Flutter PDF. You can also find that it is not possible to select any text in this PDF using PDF viewers.



Marked as answer

TV Thiago Valente Aguiar March 29, 2023 12:27 AM UTC

Thank you for the feedback, Irfana.


Loader.
Live Chat Icon For mobile
Up arrow icon