How to convert .docx to .pdf in C#

Now we are using OpenXML to read data from database and generate doc. But the final requirement is to be a pdf. So I want to know how to convert .docx to pdf in C#. Could anyone for help? Or provide some information.


You can check solutions in this link: http://www.codeproject.com/Questions/346784/How-to-convert-word-document-to-pdf-in-Csharp

I recommend using this among solutions as first:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Office.Interop.Word;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();
        wordDocument = appWord.Documents.Open(@"D:desktopxxxxxx.docx");
        wordDocument.ExportAsFixedFormat(@"D:desktopDocTo.pdf", WdExportFormat.wdExportFormatPDF);
    }

    public Microsoft.Office.Interop.Word.Document wordDocument { get; set; }
}

你可以看看像iTextSharp这样的图书馆

链接地址: http://www.djcxy.com/p/75148.html

上一篇: 一般来说,在ucLinux上,ioctl比写入/ sys文件系统更快吗?

下一篇: 如何在C#中将.docx转换为.pdf