Results 1 to 2 of 2
  1. #1
    gstkein is offline Member
    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0

    Default Question: How to change PDF text colours and remove background, with PDFBOX or other

    Hi, I want to make an apllication using pdfbox that changes all the text colour to black and removes backgrounds so pdfs can be printed saving ink.

    Unfortunatelly I haven´t found any good place to read how to use pdfbox, I've found the api but that doesn't seem to be very descriptive and the examples only helped me to find out how to browse all the pages of a pdf and with any luck save changes.

    Can anybody help me out?
    I'd like to know how to change colour for all the text and how to remove backgrounds (I think they are called background paths) and maybe background images.

    Thanks
    Last edited by gstkein; 11-13-2009 at 09:10 PM.

  2. #2
    abergmann is offline Member
    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0

    Default

    Hey, i got the same problem, i tried to parse the pdffile to get only the Textcontent but if i try this i'll get a Nullpointer...
    For me it would be okay if i just can set the background to white, then i can choose black and white printing so it would save ink too.


    Here you can see how i tried it and thats where the Nullpointer occured.
    Java Code:
    for(File pdf : pdfFiles)
        {
          PDFParser parser = new PDFParser(new FileInputStream(pdf));
          parser.parse();
          PDDocument doc = parser.getPDDocument();
          pddoc.add(doc);
          PDFTextStripper stripper = new PDFTextStripper();
          String textContent = stripper.getText(doc);
          doc.close();
         }

Similar Threads

  1. Reading text using PDFBOX
    By umadas in forum Advanced Java
    Replies: 15
    Last Post: 01-21-2012, 08:47 AM
  2. Read text content from pdf using pdfbox
    By cssatheesh in forum Advanced Java
    Replies: 0
    Last Post: 09-22-2009, 08:54 PM
  3. my code doesn't change background color
    By javanoobita in forum New To Java
    Replies: 5
    Last Post: 02-22-2009, 04:30 AM
  4. JButton onClick change color background
    By behrk2 in forum AWT / Swing
    Replies: 6
    Last Post: 07-09-2008, 04:54 PM
  5. when muse pressed the background change
    By pcman in forum Java Applets
    Replies: 1
    Last Post: 03-17-2008, 11:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •