What steps will reproduce the problem?
1. launch the program below with mydoc.odt mydocout => the mydocout is a
correct PDF (even if it has no extension)
2. rename mydoc.odt to mydoc
3. launch the program below with mydoc mydocout2 => error
What is the expected output? What do you see instead?
the expected output is mydocout2 as a correct PDF
Problem lies in org.artofsolving.jodconverter.OfficeDocumentConverter.convert :
DocumentFormat inputFormat =
formatRegistry.getFormatByExtension(inputExtension);
=> because my input has no extension, it causes the error
Solution :
provide a org.artofsolving.jodconverter.OfficeDocumentConverter.convert(File
inputFile, DocumentForm inputFormat, File outputFile, DocumentFormat
outputFormat) method
Workaround : rename the file without extension to a file with extension
PLEASE NOTE : this bug does not occur under Windows but only with OO 3.2.1.
under squeeze in headless mode
public static void main(String[] args) {
OfficeManager officeManager = new ExternalOfficeManagerConfiguration().buildOfficeManager();
try {
File odt = new File(args[0]);
File pdf = new File(args[1]);
OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
DocumentFormat pdfFormat = converter.getFormatRegistry().getFormatByExtension("pdf");
converter.convert(odt, pdf, pdfFormat);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
officeManager.stop();
}
}
Original issue reported on code.google.com by c.b...@decalog.net on 24 Nov 2011 at 4:53
Original issue reported on code.google.com by
c.b...@decalog.net
on 24 Nov 2011 at 4:53