Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9166067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:04:33+00:00 2026-06-17T15:04:33+00:00

Is there an API available in iText library to detect whether the PDF file

  • 0

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:

  1. Check if the PDF has xref compressed table.
  2. If 1 is true -> then “Uncompress” xref table.
  3. Send the byte stream for further processing.
  4. 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:04:34+00:00Added an answer on June 17, 2026 at 3:04 pm

    As it turns out, this is already supported in iText.
    You need to create a PdfReader instance and then use isNewXrefType().

    To uncompress the XRef table of a PDF document, you can use this method:

    public void uncompressXRef(String src, String dest)
        throws IOException, DocumentException {
        PdfReader reader = new PdfReader(src);
        PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
        stamper.close();
        reader.close();
    }
    

    To recompress the XRef table, use this method:

    public void recompressXRef(String src, String dest)
        throws IOException, DocumentException {
        PdfReader reader = new PdfReader(src);
        PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
        stamper.getWriter().setFullCompression();
        stamper.close();
        reader.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any API available to find the whether the .NET framework installed or
How to read .xls(ms excel) file in blackberry application. Is there any api available?
Is there any API available to find a resoruce(java file) in Eclipse workspace tree
Is there a .NET API available to get data from your XBox Live account?
Is there an available API or functionality in cocoa where i can communicate with
When there is no webservice API available, your only option might be to Screen
Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate
Does Kdiff3 have APIs available? Or is there any comparison tool's API available that
I use node.js as REST API. There are following actions available: /contacts, GET, finds
is there any API available to get the like count for different urls..

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.