I Need to convert docx file to pdf using open source library
Loading
I Need to convert docx file to pdf using open source library
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Leon DRank #851 · 2.6K reputationPosted Jul 23, 2023, 9:59 PM EDT
You can check Free Spire.Doc, it's not open source but robust and easy to use.
https://www.e-iceblue.com/Download/download-word-for-net-free.html
Here is a simple example for converting word docx to pdf:
using Spire.Doc; namespace ToPDF { class Program { static void Main(string[] args) { //Create a Document object Document document = new Document(); //Load a sample Word document document.LoadFromFile(@"C:\Users\Administrator\Desktop\Test.docx"); //Save the document to PDF document.SaveToFile("ToPDF.pdf", FileFormat.PDF); } } }In addition, it also supports lots of custom word to pdf conversion options, including encrypting the result pdf, retain bookmarks, embedding fonts and many more. You can check the following article for more details:
https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/How-to-Convert-Word-to-PDF.html
Marvin ReidRank #1,963 · 746 reputationPosted Jul 27, 2023, 11:54 AM EDT
If you cannot find a suitable open source package, you can try using the LEADTOOLS SDK. You can take that .Docx file and convert it to a PDF through use of the DocumentConverter. Here is an example:
using (DocumentConverter documentConverter = new DocumentConverter()) { var input = @"C:\Input\input.docx"); var output = @"C:\Output\output.pdf"); var jobData = DocumentConverterJobs.CreateJobData(input, output, DocumentFormat.Pdf); jobData.JobName = "Convert to Word File"; var documentWriter = new DocumentWriter(); documentConverter.SetDocumentWriterInstance(documentWriter); var renderingEngine = new AnnWinFormsRenderingEngine(); documentConverter.SetAnnRenderingEngineInstance(renderingEngine); var job = documentConverter.Jobs.CreateJob(jobData); documentConverter.Jobs.RunJob(job); }https://www.leadtools.com/help/sdk/tutorials/dotnet-fx-winforms-convert-files-with-the-document-converter.html
Vishal YelveRank #178 · 13.6K reputationPosted Jul 28, 2023, 9:54 AM EDT
https://products.fileformat.com/word-processing/net/docx-to-pdf-converter/#:~:text=In%20order%20to%20convert%20DOCX,can%20convert%20DOCX%20to%20PDF.
https://www.gemboxsoftware.com/document/examples/c-sharp-convert-word-to-pdf/6007
https://www.codeproject.com/Questions/346784/How-to-convert-word-document-to-pdf-in-Csharp
Mohit KalaRank #948 · 2.2K reputationPosted Jul 31, 2023, 6:56 AM EDT
I Need Free Library?
Vahid FarahmandianRank #961 · 2.1K reputationPosted Jul 21, 2023, 7:36 AM EDT
You can check these GitHub repos: