PDF to EXCEL convertion through Java

imgopi
@imgopi-dUGWP0 โ€ข Oct 26, 2024

Hi friends i want to do my main project on java.The main aim is to store university result in database,the university send a PDF file to respected colleges.So my activities are
1)converting PDF to excel
2)and storing that file in database
so help me and give me your suggestions for this task,
and what are the classes needed for conversion of files through Java.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • ms_cs

    @ms-cs-Ab8svl • Jan 5, 2012

    Apache PDFBox is an java API, you can use this to extract the pdf data

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 • Jan 5, 2012

    Try this out:

    import java.io.FileOutputStream;
     
    import com.lowagie.text.Document;
    import com.lowagie.text.Rectangle;
    import com.lowagie.text.pdf.BaseFont;
    import com.lowagie.text.pdf.PdfContentByte;
    import com.lowagie.text.pdf.PdfImportedPage;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
     
    public class ReadYourOwnPDFFile {
        public static void main(String[] args) {
            try {
                PdfReader reader = new PdfReader("YourOwnPDF.pdf");
                int n = reader.getNumberOfPages();
                // we retrieve the size of the first page
                Rectangle psize = reader.getPageSize(1);
               
                System.out.println(reader.getPdfVersion());
                System.out.println(reader.getFileLength());
                System.out.println(psize.height());
                System.out.println(psize.width());
            }
            catch (Exception de) {
                de.printStackTrace();
            }
        }
    }
  • imgopi

    @imgopi-dUGWP0 • Jan 5, 2012

    Thanks...

  • imgopi

    @imgopi-dUGWP0 • Jan 5, 2012

    Praveen-KumarTry this out:
    import java.io.FileOutputStream;
     
    import com.lowagie.text.Document;
    import com.lowagie.text.Rectangle;
    import com.lowagie.text.pdf.BaseFont;
    import com.lowagie.text.pdf.PdfContentByte;
    import com.lowagie.text.pdf.PdfImportedPage;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
     
    public class ReadYourOwnPDFFile {
        public static void main(String[] args) {
            try {
                PdfReader reader = new PdfReader("YourOwnPDF.pdf");
                int n = reader.getNumberOfPages();
                // we retrieve the size of the first page
                Rectangle psize = reader.getPageSize(1);
             
                System.out.println(reader.getPdfVersion());
                System.out.println(reader.getFileLength());
                System.out.println(psize.height());
                System.out.println(psize.width());
            }
            catch (Exception de) {
                de.printStackTrace();
            }
        }
    }

    First thanks for your response and this program gives information about the PDF file friend,but i need Excel file from PDF.

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 • Jan 5, 2012

    imgopiFirst thanks for your response and this program gives information about the PDF file friend,but i need Excel file from PDF.

    Okay... Lemme try out something and get back to you... ๐Ÿ˜€

  • simplycoder

    @simplycoder-NsBEdD • Jan 6, 2012

    imgopiHi friends i want to do my main project on java.The main aim is to store university result in database,the university send a PDF file to respected colleges.So my activities are
    1)converting PDF to excel
    2)and storing that file in database
    so help me and give me your suggestions for this task,
    and what are the classes needed for conversion of files through Java.

    If its fine with you, kindly upload the sample file along with the code that you have tried.

  • imgopi

    @imgopi-dUGWP0 • Jan 6, 2012

    simplycoderIf its fine with you, kindly upload the sample file along with the code that you have tried.
  • Sandhya Nattu

    @sandhya-nattu-AahfVL • Jun 29, 2012

    hi gopii ,
    did you got the source code of how to convert the pdf file to excel using java . i m also working with it will u please help me by giving code or in tracing how to convert???

  • imgopi

    @imgopi-dUGWP0 • Jul 16, 2012

    Sandhya Nattuhi gopii ,
    did you got the source code of how to convert the pdf file to excel using java . i m also working with it will u please help me by giving code or in tracing how to convert???

    Sorry for late reply
    First I convert PDF to Word then I convert it to Excel

  • Sandhya Nattu

    @sandhya-nattu-AahfVL • Jul 16, 2012

    Will you provide me code ๐Ÿ˜€ plz

  • pittypan

    @pittypan-7BouXL • Feb 20, 2014

    Sandhya Nattuhi gopii ,
    did you got the source code of how to <a href="https://www.rasteredge.com/how-to/vb-net-imaging/pdf-render-option/" target="_blank" rel="nofollow noopener noreferrer">VB.NET PDF: Set PDF Document Rendering Options in VB.NET Class</a> file to excel using java . i m also working with it will u please help me by giving code or in tracing how to convert???

    Google is a good friend. Try this link where you can find the sample code.

    <a href="https://www.codeproject.com/Answers/394089/PDF-table-data-to-Excel-using-Vb-net.aspx#answer1" target="_blank" rel="nofollow noopener noreferrer">[Solved] PDF table data to Excel using Vb.net - CodeProject</a>

  • Ainur

    @ainur-PFw5wF • Mar 28, 2014

    Hello.
    You solved the problem. Can you help me?

    imgopiHi friends i want to do my main project on java.The main aim is to store university result in database,the university send a PDF file to respected colleges.So my activities are
    1)converting PDF to excel
    2)and storing that file in database
    so help me and give me your suggestions for this task,
    and what are the classes needed for conversion of files through Java.
  • cathyhill

    @cathyhill-nOHQdu • Apr 7, 2014

    pittypanGoogle is a good friend. Try this link where you can find the sample code.

    <a href="https://www.codeproject.com/Answers/394089/PDF-table-data-to-Excel-using-Vb-net.aspx#answer1" target="_blank" rel="nofollow noopener noreferrer">[Solved] PDF table data to Excel using Vb.net - CodeProject</a><a href="https://www.rasteredge.com/how-to/vb-net-imaging/excel-converting/" target="_blank" rel="nofollow noopener noreferrer">VB.NET Excel: Convert & Render Excel Sheet to Other Documents & Images</a>


    Thanks, pitty, it helps.

  • Dinesh Chandewar

    @dinesh-chandewar-oOoKYB • Mar 27, 2017

    hi friends i want to convert pdf file into excel sheet in java programming .....so any one help me..............