Word输出高清PDF。

准备的工具:

  1. 编辑软件-word
  2. pdf管理工具-Adobe Acrobat。这里有安装包和教程(Acrobat Pro DC2022安装教程

首先,确保图片放到word里面不会被压缩。(word默认设置为压缩,这样图片不清晰)

1、文件-选项

2、

设置好以后把图片粘贴到word中。准备转PDF,快捷键ctrl+P,弹出以下页面

3、ctrl+P打印,会出现默认PDF打印机。

4、选择Adobe PDF打印机。

5、设置打印PDF的属性。( 重要)只提供一种解决方案,清晰度可以自己再改改参数,自己多尝试集中解决方案。

6、打印-选择路径-就可以查看了。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
可以将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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值