In this post, you will learn to convert Doc to PDF using Spire.Doc with few lines of code. Let us first understand more about Spire.Doc.
Introduction to Spire.Doc
Spire.DOC is a library designed to convert, create, read and write word document file. This is compatible with ASP.NET and is called Spire.Doc for .NET. We can get the reference for Spire.Doc from NuGet package manager or we can install it through the NuGet package Console.
In addition to simplicity & accuracy of this component, some of the advantages of using Spire.Doc are as follows:
Advantages of Spire.Doc
- It supports ASP.NET,ASP.NET MVC, C#, and VB.NET.
- It can be used to create a new word document.
- It is superior to other tools used for conversion in terms of speed.
- It supports the following office formats 97-2003 /2007/2010/2013.
- MS Office installation is not required to use Spire.Doc.
- It can convert the document to HTML, PDF, TXT, XML etc. and vice versa.
Spire.DOC is compatible with ASP.NET and is called Spire.DOC for .NET. We can get the reference added for Spire.DOC from NuGet package manager.
Not sure how to add NuGet package?
Here is a post to help you – Adding references using NuGet packages
After successful installation of NuGet package, you can see the DLL references being added to your project.
I have created a sample doc file (word document) on my hard drive. This DOC file will get converted to PDF with just a few lines of code.
Below is the working example:
static void Main(string args)
doc = new Document();
catch (Exception Ex)
Console.WriteLine("Error while converting Doc to PDF: " + Ex.Message);
doc = null;
We need to specify the output format option using
FileFormat as seen in the preceding code.
Run the Application – Hit F5
If there are no errors in your program, You will be able to see your DOC file converted to PDF format as shown below:
Hope, this post was useful to you. Get the Spire products you need to integrate with your application.
You can buy various Spire packages by Ice Blue from their website as per your needs.
What do you think?
If you have any questions or suggestions please feel free to email us or put your thoughts as comments below. We would love to hear from you. If you found this post or article useful then please share along with your friends and help them to learn.