Discussions

EJB design: convert word and excel to PDF using JAVA API

  1. convert word and excel to PDF using JAVA API (15 messages)

    I have to develop an appplication which uploads excel file with an attachments word and PDF .i need to convert all formats to pdf and merge all PDF's into one PDF.can anyone help me in how i can write the code using JAVA.IT is very urgent

    Thank You
    Deepa

    Threaded Messages (15)

  2. convert word and excel to PDF using JAVA API[ Go to top ]

    I would look into a jakarta poi (which does the excel java api) and then apache fop or itext library for the pdf creation.

    hope that helps,

    www.binaryfrost.com
    I have to develop an appplication which uploads excel file with an attachments word and PDF .i need to convert all formats to pdf and merge all PDF's into one PDF.can anyone help me in how i can write the code using JAVA.IT is very urgent Thank YouDeepa
  3. JExcel better than POI[ Go to top ]

    Having used both POI and JExcel, it is my opinion that JExcel is the better of the two apis. JExcel operates on lesser heap memory for a given spreadsheet. In fact ive had to rewrite code using POI to now use JExcel...
  4. JXEL[ Go to top ]

    Jxel Api is a lot simpler compared to POI ...it took us hardly 15 minutes to download & implement the APi
    Cheers Andy...
  5. You can do this with http://www.windwardreports.com

    thanks - dave
  6. no titles[ Go to top ]

    I thought, he pays attention is not merely the excel data conversion is the pdf form, but also includes some page layout forms, the picture and so on, the data is the data conversion merely, causes extremely simply, the stupidest method is itext Unifies with poi:)
    I come from china,my English is very bad:)
  7. implementation solution[ Go to top ]

    Hi Deepa, what did you end up using? We have a similar requirement in my current project. I did some initial investigation of using POI then FOP however I am not sure this is the right way to go because of relying on too many subsystems.

    I would be interested to know what you are doing with your solution.

    Kind Regards,
    Saifeldeen
  8. Hello all, So, what was the final solution for this open point. best regards, MODLOVAN Radu
  9. Hi All, we are using apache poi API. My application is working only when .xls file open&close once before run the application. Is there any properties should be changes for file? Do you want to me use JExcel? please, help me . Thanks in advance..
  10. Another solution for DOC to PDF, HTML to PDF: http://www.dancrintea.ro/html-to-pdf/ check page middle for example.
  11. I managed to converted RTF/Doc files to PDF using OpenOffice, here my steps: 1) Installed OpenOffice 2.4 (I failed to compile in OpenOffice 3 coz they have changed the jar files folder structure) 2) You need these 3 files in your classpath: unoil.jar, juh.jar, ridl.jar You will find them in: "C:\Program Files\OpenOffice.org 2.4\program\classes" (Note: Do NOT copy out these 3 files, you must linked them in the original location, or else you will get runtime error for not able to find the executable) ---------------------------------- try { // get the remote office component context com.sun.star.uno.XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); // get the remote office service manager com.sun.star.lang.XMultiComponentFactory xMCF = xContext.getServiceManager(); Object oDesktop = xMCF.createInstanceWithContext( "com.sun.star.frame.Desktop", xContext); com.sun.star.frame.XComponentLoader xCompLoader = (com.sun.star.frame.XComponentLoader) UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, oDesktop); java.io.File file = new java.io.File(sourceFile); StringBuffer sLoadUrl = new StringBuffer("file:///"); sLoadUrl.append(file.getCanonicalPath().replace('
    ', '/')); file = new java.io.File(outputFile); StringBuffer sSaveUrl = new StringBuffer("file:///"); sSaveUrl.append(file.getCanonicalPath().replace('
    ', '/')); com.sun.star.beans.PropertyValue[] propertyValue = new com.sun.star.beans.PropertyValue[1]; propertyValue[0] = new com.sun.star.beans.PropertyValue(); propertyValue[0].Name = "Hidden"; propertyValue[0].Value = new Boolean(true); Object oDocToStore = xCompLoader.loadComponentFromURL( sLoadUrl.toString(), "_blank", 0, propertyValue ); com.sun.star.frame.XStorable xStorable = (com.sun.star.frame.XStorable)UnoRuntime.queryInterface( com.sun.star.frame.XStorable.class, oDocToStore ); propertyValue = new com.sun.star.beans.PropertyValue[ 2 ]; propertyValue[0] = new com.sun.star.beans.PropertyValue(); propertyValue[0].Name = "Overwrite"; propertyValue[0].Value = new Boolean(true); propertyValue[1] = new com.sun.star.beans.PropertyValue(); propertyValue[1].Name = "FilterName"; propertyValue[1].Value = "writer_pdf_Export"; xStorable.storeToURL( sSaveUrl.toString(), propertyValue ); System.out.println("\nDocument \"" + sLoadUrl + "\" saved under \"" + sSaveUrl + "\"\n"); com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable) UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class, oDocToStore ); if (xCloseable != null ) { xCloseable.close(false); } else { com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent) UnoRuntime.queryInterface( com.sun.star.lang.XComponent.class, oDocToStore ); xComp.dispose(); } System.out.println("document closed!"); System.exit(0); ---------------------------------- Hope that helps, enjoy!
  12. Excel to pdf free trial[ Go to top ]

    http://www.theserverside.com/discussions/thread.tss?m=c.reply&thread_id=15612#330874
  13. excel tp pdf[ Go to top ]

    Hi deepa,

    did you get any solution for this situation.I also have the same requirement.

    please help.

     

  14. convert to PDF using JAVA[ Go to top ]

    Java tools for converting images to and from PDF, and now to convert from Word to PDF are available from Qoppa Software.  Low cost, conform to PDF standards, reliable, documentation and demos available.

  15. I have to develop an appplication which uploads excel file with an attachments word and PDF .i need to convert all formats to pdf and merge all PDF's into one PDF.can anyone help me in how i can write the code using JAVA.IT is very urgent

    Thank You
    Deepa

    Have you tried use iText?

  16. You can try following method to merge all PDF 's in a single file

    <code>

    public void generateSingleFile(ArrayList lstFileNames,String rptrootpath,String newFileName) throws DocumentException, IOException  { PdfReader reader = null; PdfCopyFields copy = new PdfCopyFields(new FileOutputStream(rptrootpath + newFileName)); try {       int pageCount = 0; String rptfile = ""; for(int j=0; j<lstFileNames.size(); j++) { rptfile = (String)lstFileNames.get(j); if( ( rptfile != null) && ( !rptfile.equals("")) )    { File file = new File(rptrootpath + rptfile); if (file.exists())//if file not exist { reader = new PdfReader(rptrootpath + rptfile);  pageCount = reader.getNumberOfPages(); }else { pageCount = 0; } if(pageCount>0) { copy.addDocument(reader); } logger.debug("There are " + pageCount + " pages in the original file."); } } if(copy!=null)copy.close(); if(reader!=null)reader.close(); }catch (Exception e) { logger.error("Error : ",e); } }

     

    </code>