Convert PDF to Other Format Using Spire.PDF

Introduction
  
Spire.PDF from E-iceblue is a .NET component that lets you manipulate PDF documents programmatically. Spire.PDF for .NET is a professional .NET library specially designed for developers to create, read, write, convert and print PDF document files from any .NET platform with fast and high-quality performance.
 
Background 
 
I got an opportunity from a China based company E-iceblue, to review one of their products. I selected Spire.PDF from E-iceblue, which is a .NET component that lets you manipulate PDF documents programmatically. 
 
Namespace
  1. using Spire.Pdf;  
  2. using Spire.Doc.Documents;   

Add Reference 

  • Add the following reference
  • Add the Spire.Pdf, Spire.Doc and Spire.License DLL files to the bin folder
  • Spire.Pdf contains the PDF conversion libraries.
  • Spire.Doc contains the doc conversion libraries.

Figure 1: Add Reference
 
Code

 
Figure 2: Code
 
Creating the instance of PdfDocument:
 
             PdfDocument document_doc = new PdfDocument();  
 
Load the file location, in this code “spire.pdf” is a PDF file as in the following:
 
            document_doc.LoadFromFile(@"E:\MVC APP\SpireDoc\SpireDoc\spire.pdf");  
 
Convert the PDF file into Document format using “FileFormat.Doc” as in the following:
 
            document_doc.SaveToFile("Spire.doc", FileFormat.DOC);  
 
Launch the conversion process as in the following:
 
           System.Diagnostics.Process.Start("Spire.doc");  
 
Examples
 
The following converts a PDF to Xps:
  1. //Creating instance of PdfDocument  

  2. PdfDocument document = new PdfDocument();  
  3.    
  4. //Loading the File path of pdf file  
  5.    
  6. document.LoadFromFile(@"E:\MVC APP\SpireDoc\SpireDoc\SpireXps.pdf");  
  7.    
  8. //Save Spire.Pdf.PdfDocument object as XPS format.  
  9.    
  10. document.SaveToFile("SpireXps.xps", FileFormat.XPS);  
  11.    
  12. //Launch XPS  
  13.    
  14. System.Diagnostics.Process.Start("SpireXps.xps");  
Output
 
 
Figure 3: Output 1
 
The following converts a PDF to Doc:
  1. //Creating instance of PdfDocument  
  2.    
  3. PdfDocument document_doc = new PdfDocument();  
  4.    
  5. //Loading the File path of pdf file  
  6.    
  7. document_doc.LoadFromFile(@"E:\MVC APP\SpireDoc\SpireDoc\spire.pdf");  
  8.    
  9. //Save Spire.Pdf.PdfDocument object as DOC format.  
  10.    
  11. document_doc.SaveToFile("Spire.doc", FileFormat.DOC);  
  12.    
  13. //Launch Document  
  14.    
  15. System.Diagnostics.Process.Start("Spire.doc");  
 Output
 
 
Figure 4: Output2
 
Important points
  • Merge/split PDF documents.
  • Set PDF position, title display, resize, page mode and print scaling, and so on.
  • Protect PDF documents by setting passwords and digital signature.
  • Overlay documents.
  • Decrypt PDF Document.
  • Fast Conversion Process.
Reference
Here is the article from my tech blog:

Up Next
    Ebook Download
    View all
    Learn
    View all