This is an all-in-one solution to convert Word to PDF. Within this solution, you can either create a word from scratch or load a word template from folder, and then edit the document as you like; finally you can effortlessly convert word to PDF in C#, VB.NET. The conversion can be doc to PDF or docx to PDF.
Spire.Doc for .NET is a professional .NET library which enables users to directly manage word editing without Microsoft Word being installed, after the editing, you can convert the document to PDF in 2 steps.
Below is the an effective screenshot of the document which will be converted to PDF, at the end Of this post, you can find the target PDF.
Now feel free to download Spire.Doc for .NET and convert word to PDF for personal use or evaluation. The whole process of converting word to PDF in C#, VB.NET can be described as 2 simple steps.
1. Declare a document and load document which you prepare by using ocument.LoadFromFile() method. The parameter passed to this method is file name string.
2. Save Word document as PDF by using document.SaveToFile() method. Parameters passed to this method is file name string and file format. The file format must be PDF.
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:\work\documents\TestSample.docx"); //Convert Word to PDF document.SaveToFile("toPDF.PDF", FileFormat.PDF); //Launch Document System.Diagnostics.Process.Start("toPDF.PDF"); } } }
Imports System Imports Spire.Doc Imports Spire.Doc.Documents Namespace DoctoPDF Friend Class toPDF Shared Sub Main(ByVal args() As String) 'Load Document Dim document As New Document() document.LoadFromFile("E:\work\documents\TestSample.docx") 'Convert Word to PDF document.SaveToFile("toPDF.PDF", FileFormat.PDF) 'Launch Document System.Diagnostics.Process.Start("toPDF.PDF") End Sub End Class End Namespace
After running the demo, you may find a PDF document launched on your computer:
Spire.Doc is an MS Word component which enables user to perform a wide range of Word document processing tasks directly, such as generate, read, write and modify Word document for .NET and Silverlight.
More about This .NET Word component