hi
friend,
I have used jodconverter-core-3.0-beta-4.jar.
The purpose is to convert any office file to pdf.
But it is not sure that jodconverter can convert office file to image or other file type.
I think it will be OK to convert office file to pdf file.If you use this, you will need to install openoffice and start this service.......
I have a sample example ..........
please refer it.....you will also need some jar file to implement
/***
parameter: inputFile ------ source file
outputFile-------destination file which want to convert
***/
public void convertFile(File inputFile, File outputFile) throws Exception{
OfficeManager officeManager = new DefaultOfficeManagerConfiguration().buildOfficeManager();
OfficeDocumentConverter documentConverter = new OfficeDocumentConverter(officeManager);
try {
officeManager.start(); //starting soffice manager
String pageRange = "1-1"; // converting page count 1-1 to convert only first page
DocumentFormat documentFormat =getDocumentFormat(pageRange);
long start = System.currentTimeMillis();
documentConverter.convert(inputFile, outputFile,documentFormat);
long end = System.currentTimeMillis();
double duration = (end - start) / 1000d;
System.out.println("Conversion took: " + duration + "seconds.");
System.out.println("Convert complete!");
} catch (Exception exception) {
System.out.println(String.format("failed conversion: %s [%db] to %s; %s; input file: %s", inputFile.getName(), inputFile.length(), outputFile.getName(), exception, inputFile.getName()));
throw new Exception("conversion failed", exception);
} finally {
officeManager.stop();//stopping soffice manager
officeManagerHandler=null;
}
}
////if you want to convert this pdf to image , you will use some code of converting pdf to image.....