Results 1 to 6 of 6

Thread: Java For Reading PDF Files

  1. #1
    Join Date
    Nov 2009
    Posts
    877

    Java For Reading PDF Files

    Hello, I have recently started using of Java Programming Language. I want to know the steps from which I can able to read the PDF files with the help of java programming language. If anyone is having idea regarding the same, then please give me reply for the same.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Java For Reading PDF Files

    • You may need to open you java first. Then you can able to create PDF file by the use of code line below:
      Code:
      PdfDocument doc = new PdfDocument(one)
    • Now you will need a reader for reading so use the code line below:
      Code:
      PdfReader reader = PdfReader.fileReader("<filename.pdf")
    • Where "Title of pdf.pdf" is, insert the file name if the PDF you wish to read.
    • For displaying content of document use the code below:
      Code:
      System.out.println("Number of pages in Title of pdf.pdf is " + doc.getPageCount());
    • Close all the other streams related to the file.
      Code:
      reader.dispose();

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Java For Reading PDF Files

    You can make use of the steps below to get the solution for raeading pdf fiels in java:
    • The Java Developer's Resource
    • 1000 Java Tips (Alexandre Patchine, Dr. Heinz M. Kabutz)
    • Java Data Objects (Robin Roos)
    • Java Testing and Design (Frank Cohen)

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Java For Reading PDF Files

    Use the code below to read the pdf files from your java :
    Code:
    PdfReader pr = PdfReader.fileReader("doc.pdf");
    PdfDocument pd = new PdfDocument(r);
    System.out.println("No. of pages isn doc.pdf is " + pd.getPageCount());
    pr.dispose();

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Java For Reading PDF Files

    You can simply use the JPedal for reading the pdf files in java. It is having following features:
    • It is having large size of font technologies.
    • It can provide you support for the color spaces as DeviceRGB, CalRGB, DeviceGRAY, CalGRAY, ICC, indexed, DeviceCMYK and DeviceN.
    • You can also able to view the tiff, jpg and gif file formats.
    • You can able to perform extraction.
    • You can able to search in your pdf file though it.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Java For Reading PDF Files

    Follow the steps for reading the pdf files in java:
    1. First thing you need to do is to create a pdf file with the help of PdfDocument class.
    2. Then for reading the pdf file you need to make use of the method asfileReader which is provided by the class PdfReader.
    3. Now for reading the content make use of the total number of pages by the method of getPageCount().
    4. Now just close all the streams of the pdf file by dispose() method.

Similar Threads

  1. Reading an XML file in Java
    By Chetna in forum Software Development
    Replies: 7
    Last Post: 13-07-2011, 04:31 PM
  2. Problem in reading file in java
    By TechGate in forum Software Development
    Replies: 5
    Last Post: 02-02-2010, 03:05 AM
  3. Reading tables in java.io
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 20-01-2010, 10:30 AM
  4. Java reading from a file
    By xqc72 in forum Software Development
    Replies: 1
    Last Post: 20-11-2009, 08:20 AM
  5. Java - Reading from console
    By WinDoWLoCuS in forum Software Development
    Replies: 3
    Last Post: 09-11-2009, 12:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,265,107.01934 seconds with 17 queries