Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: reading pdf by using java

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Location
    delhi
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default reading pdf by using java

    i am reading pdf through java and write that data in .csv file.problem is like that when i read 500 pages from pdf at that time they can write only 496 lines what can i do for that i can read all 500 pages from the pdf
    my code is like..............



    public class pdf1 {


    public static void main(String[] args) throws SQLException, ClassNotFoundException {
    try {

    PdfReader reader = new PdfReader("me1.pdf");

    // int n = reader.getNumberOfPages();
    File outFile = new File("b.csv");
    int n=500;
    int count=0;
    BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));

    for(int i=1;i<=n;i++)
    {
    String str=PdfTextExtractor.getTextFromPage(reader, i);
    System.out.println(str);
    writer.write(str);
    count++;

    System.out.println(count);

    } catch (IOException e) {
    e.printStackTrace();
    }

    }

    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: reading pdf by using java

    Welcome! Please read this topic to learn how to post code correctly and other useful info for new members.

    Java class names are capitalized.

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Location
    delhi
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default reading data from pdf file

    i want to read pdf file(that file in marathi language and font is Kiran) how can i red a pdf file and write into another file.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: reading pdf by using java

    Please don't post mutiple threads on the same topic. If you need to freshen the existing topic with new info, updated code, or to properly post the code you've already posted, do that. But don't start another topic.

  5. #5
    Junior Member
    Join Date
    Oct 2013
    Location
    delhi
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: reading pdf by using java

    k............... give me suggestion about that

Similar Threads

  1. java pdf
    By K.A Naqvi in forum What's Wrong With My Code?
    Replies: 9
    Last Post: January 15th, 2014, 02:36 PM
  2. Replies: 3
    Last Post: December 13th, 2013, 07:36 AM
  3. how to get the print preview for pdf file in java
    By sivanand in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 20th, 2013, 12:55 PM
  4. Convert DOC,XLS to PDF with Java
    By comm in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: July 2nd, 2013, 04:10 AM
  5. Save java frame as pdf/image.
    By Austin777 in forum Java Theory & Questions
    Replies: 6
    Last Post: October 16th, 2012, 08:01 AM

Tags for this Thread