다음 코드를 사용하여 JOD를 사용하여 .doc를 .pdf로 변환합니다.JODConverter 문제 및 헤드리스 모드에서 LibreOffice 실행
File inputFile = new File("document.doc");
File outputFile = new File("document.pdf");
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
// close the connection
connection.disconnect();
는하지만 헤드리스 (headless) 모드에서 LibreOffice와를 시작하는 별도
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
를 실행해야합니다.
프로그래밍 방식으로 LibreOffice를 시작하는 방법이 있습니까? 또는 변환을 수행하기 위해 LibreOffice 폴더의 경로를 JOD에 줄 수는 없습니까?
JODconverter 3.0 필요한 경우, http://code.google.com/p/jodconverter/wiki/GettingStarted를 참조 LibreOffice와 시작하는 방법을 갖고있는 것 같아요. –