Extract text including field values

Hello,

Why the text extracted from the attached PDF is not bringing the data from the fields in the PDF?

Is there a way to extract the text including the fields values?

We are using Aspose.Pdf.Kit 3.9.0.0.

Thanks,

Juno

Hi Juno,

Please flatten the form fields using Form.FlattenAllFields before extracting the text; after that the form field values will be extracted as part of the complete PDF text.

If you have any further questions, please do let us know.
Regards,

Hello,

Flattening the fields is giving the following error trying to split to pages,

System.IO.IOException: Invalid pdf format:pdf head signature is not found!: v3.9.0.0
at Aspose.Pdf.Kit.PdfFileEditor.SplitToPages(Stream inputStream)

Our code snippet,

MemoryStream flatPDFStream = new MemoryStream();
Form form = new Form(path, flatPDFStream);
form.FlattenAllFields();
MemoryStream[] pages = new PdfFileEditor().SplitToPages(flatPDFStream);
flatPDFStream.Close();

Is there something missing in the code? The PDF I'm testing with is attached to this post.

Thanks,

Juno

Hi Juno,

Please close the Form object using Form.Save method. I have tested this issue using the Save method and it worked fine. Please try it at your end and if you still find the same issue, please do let us know.

We’re sorry for the inconvenience.
Regards,