Tag: converter

java中的Docx到Pdf转换器

以下代码不适用于Apache poi 3.16。 有人可以提供正确的解决方案,在我的项目中只有一些依赖使用 public void ConvertToPDF(String docPath, String pdfPath) { try { InputStream doc = new FileInputStream(new File(docPath)); XWPFDocument document = new XWPFDocument(doc); PdfOptions options = PdfOptions.create(); OutputStream out = new FileOutputStream(new File(pdfPath)); PdfConverter.getInstance().convert(document, out, options); System.out.println(“Done”); } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); } catch (IOException ex) { System.out.println(ex.getMessage()); } } 例外: Exception in […]

OpenOffice使用JAVA将doc转换为pdf

我知道它有很多问题。 但我已经阅读了大量的内容,它仍然无法正常工作。 我已将OpenOffice安装到我的comp: https : //www.openoffice.org/download/index.html 我也试过这个解决方案,不起作用: 连接到OpenOffice .org时连接失败 如果我想运行我的代码,我会收到以下错误: Exception in thread “main” java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect(AbstractOpenOfficeConnection.java:79) at TestCon.main(TestCon.java:24 ) 如何管理连接到我的openoffice程序。 PS:我想在Windows 7 64x上使用它 我用这个简单的代码 import java.io.File; import java.net.ConnectException; import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; public class TestCon { /** * @param args * @throws ConnectException […]