本篇文章主要介绍了如何使用Spire.Doc 保留或禁用从 Word 到 PDF 转换的超链接,欢迎查阅!
超链接为读者提供了更多的附加信息,它被广泛用于我们的 word 文档。Spire.Doc 具有强大的超链接文字元素操作功能。开发者可以在word文档中添加、修改和删除超链接。
以下是有关如何禁用或保留从 word 到 PDF 的超链接的代码片段。
第 1 步:加载带有超链接的 word 文档。
Document doc = new Document();doc.LoadFromFile("Sample.docx");
第 2 步:创建 ToPdfParameterList 的实例。
ToPdfParameterList pdf = new ToPdfParameterList();
第 3 步:将 DisableLink 设置为 true 以删除结果 PDF 页面的超链接效果。
//set DisableLink to false to preserve the hyperlinkspdf.DisableLink = true;
第 4 步:保存 PDF 文件。
doc.SaveToFile("result.pdf", pdf);
从结果 PDF 页面保留超链接的有效屏幕截图。

从结果 PDF 页面禁用超链接的有效屏幕截图。

将word文档转换为PDF文件时如何保留超链接的完整代码:
using Spire.Doc;namespace DOCPDF{class Program{static void Main(string[] args);public void WordtoPDFwithHyperlinks(){Document doc = new Document();doc.LoadFromFile("Sample.docx");ToPdfParameterList pdf = new ToPdfParameterList();//set DisableLink to false to preserve the hyperlinkspdf.DisableLink = true;doc.SaveToFile("result.pdf", pdf);}}}
欢迎下载|体验更多E-iceblue产品
如需获取更多产品相关信息请咨询在线客服
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!