0

I have a PDF form where there are check boxes given as images in the PDF. I am using itext to read the PDF, I also want to get the value of the checkbox as ticked or unticked.

iText does not return anything for the images, below is the iText code:

PdfReader reader = new PdfReader(path);

Rectangle mediaboxKeys=reader.getPageSize(i);

mediaboxKeys.setRight((float) 100.00);

RenderFilter[] filterKeys = {new RegionTextRenderFilter(mediaboxKeys)};

FilteredTextRenderListener strategyKeys = new FilteredTextRenderListener(new LocationTextExtractionStrategy(), filterKeys);

String[] keysFromPage = PdfTextExtractor.getTextFromPage(reader, i, strategyKeys).split("\\r?\\n");

Attached is the pdf : https://drive.google.com/file/d/1D9TNnHZe5kqwv6LKIVO94Am1nl8AnrB1/view

  • To understand how that tick actually is constructed, we'd need an actual pdf file, not merely an image of one. – mkl Sep 26 '18 at 14:52
  • @mkl Thanks for your response, I have added the file through google drive, help much appreciated... – Ranith Ranawaka Sep 26 '18 at 16:06
  • Ok, those check boxes are simple bitmap images. You might proceed like in [this answer to "Extraction of images present inside a paragraph"](https://stackoverflow.com/a/28087521/1729265). Instead of merely writing the images to file you likely will want to analyze it and check whether it's checked or not. Depending on your exact iText versions, some adaptions of the code may be necessary. – mkl Oct 03 '18 at 08:51

0 Answers0