Is there an API available in iText library to detect whether the PDF file has compressed xref table?
PDFReader class of this library has some useful API with regards to xref, but none serve my purpose.
The requirement is to:
- Check if the PDF has xref compressed table.
- If 1 is true -> then “Uncompress” xref table.
- Send the byte stream for further processing.
- Once the processing completes “Compress” back the xref table to its original form
Any pointers in this regard would be appreciated.
P.S.: The implementation is not restricted to iText. Any other Java library which can achieve it can be used. Licencing (if required) is also not an issue.
As it turns out, this is already supported in iText.
You need to create a
PdfReaderinstance and then useisNewXrefType().To uncompress the XRef table of a PDF document, you can use this method:
To recompress the XRef table, use this method: