How to convert .docx to .pdf in C #

Now we use OpenXML to read data from the database and create the document. But the final requirement should be pdf. So I want to know how to convert .docx to pdf in C #. Can anyone help? Or provide some information.

+6
source share
2 answers

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

I recommend using this among solutions as the 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:\desktop\xxxxxx.docx"); wordDocument.ExportAsFixedFormat(@"D:\desktop\DocTo.pdf", WdExportFormat.wdExportFormatPDF); } public Microsoft.Office.Interop.Word.Document wordDocument { get; set; } } 
+6
source

You can take a look at libraries like iTextSharp

-3
source

Source: https://habr.com/ru/post/956618/


All Articles