简单快速的word转成pdf转换方法

十一黄金期马上就要到了,好多童鞋也趁闲报了团去杭州、云南、福建、北京等地方旅行!这太让人期待了。可是一想到手头上这些文件资料还未处理,心里的那团兴奋之火熄了不少。要知道Word和PDF本身不是同属性的文本格式,要将Word转换成PDF格式的电子书,没有一个辅助的工具是万万完成不了的。
  现在小编为大家推荐一些Word转换方法和软件,相信一定能够帮助大家完成任务。
  PDF转换方法分为二类,从简单到容易,动手能力强的直接看第二类。
  一、简单方便、在线转换
  对于大多数电脑小白用户来说,快速解决燃眉之急才是大事儿,有一款非常简单易行的在线word转pdf——迅捷在线pdf转换器,对于大多数简单的文字PDF文档还是很好用的,又不用安装软件让系统变慢,可以尝试一下。
  如果仅仅是想快速获得全部PDF文档里面的文字图片,不用那么麻烦的转换成Word,把你想要提取内容的Word文档添加到软件中,选择转换的格式类型“Word转PDF”,然后按下生成PDF文档,就可以离线下载PDF文档了,非常的方便。
  二、软件推荐,自己动手
   word转换成pdf转换器对于所有PDF相关和文档处理的事情都能做。比如PDF文档转换成Word/Excel/PPT/Txt、PDF文档编辑、去水印、解决乱码等。
  比较亮点的是图片版Word也能转成PDF文字,甚至手机拍摄的图片也可以转到PDF文本中,对于处理多文档转换的用户是非常便捷的。如果你想生生、快捷、完美地转换好文档的话,不妨尝试一下这款软件,效果一定会让你满意。
word转换成pdf转换器 http://www.onlinedown.net/soft/569669.htm
可以将word,ppt转换成pdf格式, 1.安装《Apache_OpenOffice_4.1.5_Win_x86_install_zh-CN.exe》 2.将jar包加入到工程中 3.编写Java类,注意配置安装的位置 package com.han.office; import java.io.File; import java.util.Date; import java.util.regex.Pattern; import org.artofsolving.jodconverter.OfficeDocumentConverter; import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; import org.artofsolving.jodconverter.office.OfficeManager; import com.sun.star.util.FileIOException; /** * 这是一个工具类,主要是为了使Office2003-2007全部格式的文档(.doc|.docx|.ppt|.pptx) * 转化为pdf文件<br> * @date 2018-1-18 * @author hanshaobin * */ public class Officer { public static void main(String[] args) { Officer office2pdf = new Officer(); try { office2pdf.office2pdf("d:/test.doc", "d:/java_" + new Date().getTime() + ".pdf"); office2pdf.office2pdf("d:/test.pptx"); } catch (FileIOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 使Office2003-2007全部格式的文档(.doc|.docx|.ppt|.pptx) 转化为pdf文件<br> * * @param inputFilePath * 源文件路径,如:"d:/test.docx" * @param outputFilePath * 目标文件路径,如:"d:/test_docx.pdf" * @return * @throws FileIOException * 文件格式不正确 */ public boolean office2pdf(String inputFilePath, String outputFilePath) throws FileIOException { if(!isRigthFileFix(inputFilePath)){ throw new FileIOException("文件格式不正确"); } boolean flag = false; OfficeManager officeManager = getOfficeManager(); // 连接OpenOffice OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); // long begin_time = new Date().getTime(); // 判断目标文件路径是否为空 if (null == outputFilePath) { // 转换后的文件路径 outputFilePath = getOutputFilePath(inputFilePath); } try{ converterFile(inputFilePath, outputFilePath, converter); flag = true; }catch(Exception e){ e.printStackTrace(); } officeManager.stop(); // long end_time = new Date().getTime(); // System.out.println("文件转换耗时:[" + (end_time - begin_time) / 1000 + "]s"); return flag; } /** * 使Office2003-2007全部格式的文档(.doc|.docx|.ppt|.pptx) 转化为pdf文件<br> * 默认转换位置与源文件位置相同,文件名相同 * @param inputFilePath * 源文件路径,如:"d:/test.docx" * @return * @throws FileIOException * 文件格式不正确 */ public boolean office2pdf(String inputFilePath) throws FileIOException { return office2pdf(inputFilePath, null); } /** * 根据操作系统的名称,获取OpenOffice4的安装目录<br> * 如我的OpenOffice 4安装在:C:\\Program Files (x86)\\OpenOffice 4<br> * @return OpenOffice 4的安装目录 */ public String getOfficeHome() { String osName = System.getProperty("os.name"); if (Pattern.matches("Linux.*", osName)) { return "/opt/openoffice.org4"; } else if (Pattern.matches("Windows.*", osName)) { return "C:\\Program Files (x86)\\OpenOffice 4"; } else if (Pattern.matches("Mac.*", osName)) { return "/Application/OpenOffice.org.app/Contents"; } return null; } /** * 连接OpenOffice 并且启动OpenOffice * @return */ public OfficeManager getOfficeManager() { DefaultOfficeManagerConfiguration config = new DefaultOfficeManagerConfiguration(); // 获取OpenOffice 4的安装目录 String officeHome = getOfficeHome(); config.setOfficeHome(officeHome); // 设置超时时间为5分钟 config.setTaskExecutionTimeout(1000 * 60 * 5L); // 启动OpenOffice的服务 OfficeManager officeManager = config.buildOfficeManager(); officeManager.start(); return officeManager; } /** * 转换文件 * @param inputFilePath * 转换文件的路径及名称,例如:d:/test.doc * @param outputFilePath * 目标文件的路径及名称,例如:d:/test.pdf * @param converter */ public void converterFile(String inputFilePath, String outputFilePath, OfficeDocumentConverter converter) { File inputFile = new File(inputFilePath); File outputFile = new File(outputFilePath); // 假如目标路径不存在,则新建该路径 if (!outputFile.getParentFile().exists()) { outputFile.getParentFile().mkdirs(); } // 文件转换 converter.convert(inputFile, outputFile); } /** * 获取输出文件 * @param inputFilePath * 输入文件的位置及文件名称,如:"d:/test.docx" * @return * 默认的输出文件路径:如:"d:/test.pdf" */ public String getOutputFilePath(String inputFilePath) { String outputFilePath = inputFilePath.substring(0,inputFilePath.lastIndexOf('.'))+".pdf"; return outputFilePath; } /** * 获取inputFilePath的后缀名,如:"d:/test.pptx"的后缀名为:"pptx"<br> * * @param inputFilePath * @return */ public String getPostfix(String inputFilePath) { return inputFilePath.substring(inputFilePath.lastIndexOf(".") + 1); } /** * 检查文件是否是指定格式 * @param inputFilePath * 输入文件的路径 * @return * 是指定格式返回true ,否则返回 false */ public boolean isRigthFileFix(String inputFilePath){ String[] fixes =new String[]{"doc","docx","ppt","pptx"}; boolean flag = false; String fix = getPostfix(inputFilePath); for (String f : fixes) { if(f.equalsIgnoreCase(fix)){ flag = true; break; } } return flag; } } 工具下载位置:https://pan.baidu.com/s/1brhhbdH
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值