乔山办公网我们一直在努力
您的位置:乔山办公网 > word文档 > 如何将word转换为pdf-Spire.Doc 教程:如何将Word转换为PDF

如何将word转换为pdf-Spire.Doc 教程:如何将Word转换为PDF

作者:乔山办公网日期:

返回目录:word文档

这是将Word转换为PDF的一体化解决方案。 在此解决方案中,我们从头开始创建一个单词,或者从文件夹加载单词模板,然后根据需要编辑文档在C#,VB.NET中将单词转换为PDF。 转换可以是PDF格式或docx到PDF格式。


Spire.Doc for .NET是一个专业的.NET库,使用户可以直接管理Word编辑,而不需要安装Microsoft Word,编辑完成后,您可以通过两步将文档转换为PDF。


以下是将被转换为PDF文档的有效截图,在图片末尾,可以找到目标PDF。


免费下载Spire.Doc for .NET并将其转换为PDF以供个人使用或评估。 在C#中将Word转换为PDF的整个过程可以描述为2个简单的步骤。


1.通过使用ocument.LoadFromFile方法声明您准备的文档和加载文档,传递给该方法的参数是文件名字符串。


2.使用document.SaveToFile方法将Word文档另存为PDF,传递给此方法的参数是文件名字符串和文件格式,文件格式必须为PDF格式。


[C#]


using System;using Spire.Doc;using Spire.Doc.Documents;namespace DoctoPDF{ class toPDF { static void Main(string[] args) { //Load Document Document document = new Document; document.LoadFromFile(@"E:workdocumentsTestSample.docx"); //Convert Word to PDF document.SaveToFile("toPDF.PDF", FileFormat.PDF); //Launch Document System.Diagnostics.Process.Start("toPDF.PDF"); } }}

[VB.NET]


Imports SystemImports Spire.DocImports Spire.Doc.DocumentsNamespace DoctoPDF Friend Class toPDF Shared Sub Main(ByVal args As String) 'Load Document Dim document As New Document document.LoadFromFile("E:workdocumentsTestSample.docx") 'Convert Word to PDF document.SaveToFile("toPDF.PDF", FileFormat.PDF) 'Launch Document System.Diagnostics.Process.Start("toPDF.PDF") End Sub End ClassEnd Namespace

运行演示后,您将会在计算机上发现一个PDF文档:


相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网