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 6215183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:00:32+00:00 2026-05-24T07:00:32+00:00

I have a PDF file that’s an output from an OCR processor, this OCR

  • 0

I have a PDF file that’s an output from an OCR processor, this OCR processor recognizes the image, adds the text to the pdf but at the end places a low quality image instead of the original one (I have no idea why anyone would do that, but they do).

So, I would like to get this PDF, remove the image stream and leave the text alone, so that I could get it and import (using iText page importing feature) to a PDF I’m creating myself with the real image.

And before someone asks, I have already tried to use another tool to extract text coordinates (JPedal) but when I draw the text on my PDF it isn’t at the same position as the original one.

I’d rather have this done in Java, but if another tool can do it better, just let me know. And it could be image removal only, I can live with a PDF with the drawings in there.

  • 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-05-24T07:00:33+00:00Added an answer on May 24, 2026 at 7:00 am

    I used Apache PDFBox in similar situation.

    To be a little bit more specific, try something like that:

    import org.apache.pdfbox.exceptions.COSVisitorException;
    import org.apache.pdfbox.exceptions.CryptographyException;
    import org.apache.pdfbox.exceptions.InvalidPasswordException;
    import org.apache.pdfbox.pdmodel.PDDocument;
    import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
    import org.apache.pdfbox.pdmodel.PDPage;
    import org.apache.pdfbox.pdmodel.PDResources;
    import java.io.IOException;
    
    public class Main {
        public static void main(String[] argv) throws COSVisitorException, InvalidPasswordException, CryptographyException, IOException {
            PDDocument document = PDDocument.load("input.pdf");
    
            if (document.isEncrypted()) {
                document.decrypt("");
            }
    
            PDDocumentCatalog catalog = document.getDocumentCatalog();
            for (Object pageObj :  catalog.getAllPages()) {
                PDPage page = (PDPage) pageObj;
                PDResources resources = page.findResources();
                resources.getImages().clear();
            }
    
            document.save("strippedOfImages.pdf");
        }
    }
    

    It’s supposed to remove all types of images (png, jpeg, …). It should work like that:

    Sample article
    .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pdf file.I need to find all the hyperlinks available in that
I have a PDF file, which contains data that we need to import into
I have this: Dim myTemp As String myTemp = System.DateTime.Now().ToString(MMMddyyyy_HHmmss) & .pdf System.IO.File.Copy(myFile, c:\
I have a PDF that is being generated from HTML source using HTMLDOC. While
I have a PDF file that I want to convert to PowerPoint using .NET.
I have a pdf file that the user has to see and click on
I have a PDF file that functions as a template containing only textboxes. Is
I have a savable PDF file that has a bunch of fields that users
I have a large PDF file that is a floor map for a building.
I have a basic PDF file that I has 5 different blank content areas

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.