word打印为pdf去掉批注和修订记录

对于这个问题某乎上充斥着垃圾回答,大多引流到自家开发的pdf产品上。其实背后的方法都是一样的,就是关掉批注,用word自带的功能就能解决,凡是word编辑软件都有类似功能

直接用word打印为pdf后的效果

在这里插入图片描述
下图为打印出来的pdf文件,右侧有批注栏,左侧有两道竖线标注批注在原文中的位置:
在这里插入图片描述

解决办法

审阅Review → \rightarrow 修订Tracking → \rightarrow 将All Markup 修改为 No Markup

在这里插入图片描述
这样显示出来的word文档就没有批注之类的:
在这里插入图片描述

打印后是一样的效果:
在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要将带批注Word文档换为带批注PDF,你可以使用Java开发的一些开源库,比如Apache POI和iText等。这些库都提供了API来实现WordPDF换。 以下是使用Apache POI和iText实现带批注WordPDF换的示例代码: 首先,你需要使用Maven或Gradle等工具将Apache POI和iText添加到你的项目依赖中: ```xml <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.13</version> </dependency> ``` 然后,使用以下代码将带批注Word文档换为带批注PDF: ```java import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import org.apache.poi.xwpf.converter.pdf.PdfConverter; import org.apache.poi.xwpf.usermodel.XWPFDocument; import com.itextpdf.text.Document; import com.itextpdf.text.PageSize; import com.itextpdf.text.pdf.PdfAnnotation; import com.itextpdf.text.pdf.PdfArray; import com.itextpdf.text.pdf.PdfName; import com.itextpdf.text.pdf.PdfString; import com.itextpdf.text.pdf.PdfWriter; public class WordToPdfWithCommentsConverter { public static void main(String[] args) throws Exception { String inputWordPath = "input.docx"; String outputPdfPath = "output.pdf"; File inputFile = new File(inputWordPath); File outputFile = new File(outputPdfPath); FileInputStream inputStream = new FileInputStream(inputFile); XWPFDocument document = new XWPFDocument(inputStream); OutputStream outputStream = new FileOutputStream(outputFile); PdfWriter writer = PdfWriter.getInstance(document, outputStream); writer.setInitialLeading(12.5f); writer.setPageSize(PageSize.A4); document.open(); PdfConverter.getInstance().convert(document, writer, null); document.close(); // Add the comments to the PDF PdfAnnotation comment = PdfAnnotation.createText(writer, null, "Comment", "This is a comment", false, "Comment"); comment.setTitle(new PdfString("Comment")); comment.setContents(new PdfString("This is a comment")); comment.put(PdfName.NAME, new PdfString("Comment")); comment.put(PdfName.INDEX, new PdfArray(0, 0)); writer.addAnnotation(comment); outputStream.close(); } } ``` 这个示例代码假设你已经将要换的带批注Word文档保存在名为input.docx的文件中,并且你想将换后的带批注PDF保存为名为output.pdf的文件。你可以根据实际情况更改输入和输出路径。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值