Showing posts with label Doc Converstion. Show all posts
Showing posts with label Doc Converstion. Show all posts

Convert EXCEL,DOC,JPEG,PPT,BMP to PDF format using java code.

7

Category: , , , , ,

Perquisite to run this code,


1-Use Eclipse and java 1.5 or later
2-Download JODConvertor from the URL
3-http://code.google.com/p/jodconverter/downloads/list
4-Add all the jar file in lib directory of JODconvertor to your project.
5-Download Openoffice 3.0 from URL http://download.openoffice.org/other.html#tested-full
5-Install the Openoffice 3.0

Limitation
A:- It cannot be multi-threaded.
B:- It cannot convernt MULTI-TIFF images to PDF but it can convert single page TIFF to PDF.

import java.io.*;
import org.artofsolving.jodconverter.OfficeDocumentConverter;
import org.artofsolving.jodconverter.OfficeDocumentConverter.*;
import org.artofsolving.jodconverter.office.*;
import org.artofsolving.*;
import org.artofsolving.jodconverter.document.*;
import org.artofsolving.jodconverter.process.*;
import org.artofsolving.jodconverter.util.*;
public class Main {
public static void main(String[] args) throws Exception {
conversion();
}
public static void conversion(){
OfficeManager officeManager = new DefaultOfficeManagerConfiguration().buildOfficeManager();
officeManager.start();
OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
converter.convert(new File("C:/Temp/first.doc"), new File("C:/Temp/Doctest.pdf"));
officeManager.stop();
System.out.println("Hellow WOrld , its done");
}

Ask me if you are not able to run it.

Happy Conversion.