可以使用Spire.Doc for .NET在 Azure 应用程序(例如 Azure Web 应用程序和 Azure Functions 应用程序)中执行 Word 到 PDF 的转换。在本文中,您可以看到使用 Spire.Doc for .NET 实现此功能的代码示例。
Spire.Doc 最新下载
欢迎下载|体验更多E-iceblue产品技术交流Q群(767755948)
输入Word文档:
第 1 步:安装 Spire.Doc NuGet 包作为 项目的参考。
第 2 步:添加以下代码以将 Word 转换为 PDF。
[C#]
//Create a Document instanceDocument document = new Document();//Load the Word documentdocument.LoadFromFile(@"sample.docx");//Create a ToPdfParameterList instanceToPdfParameterList ps = new ToPdfParameterList{UsePSCoversion = true};//Save Word document to PDF using PS conversiondocument.SaveToFile("ToPdf.pdf", ps);
[]
Private Sub SurroundingSub()Dim document As Document = New Document()document.LoadFromFile("sample.docx")Dim ps As ToPdfParameterList = New ToPdfParameterList With {.UsePSCoversion = True}document.SaveToFile("ToPdf.pdf", ps)End Sub
输出 PDF 文档: