SautinSoft is an Internet-oriented software development company
  SautinSoft on Facebook SautinSoft on Twitter 
 
How to convert PDF to Word in C# and VB.Net?
 
    PDF to Image in C# and VB.Net

The PDF Focus .Net is a standalone 100% managed C# library. It enables to any .Net application to convert PDF to Word, RTF, extract Text from PDF and rasterize PDF to Images.

The library represents only the file "SautinSoft.PdfFocus.dll", it's absolutely standalone and independent and doesn't require Adobe Acrobat or MS Word installed.

To include in any .Net app (ASP.Net, WinForms, Console etc) the ability of converting PDF to Word you have to only copy the file "SautinSoft.PdfFocus.dll" into your Bin folder and add the reference to it.

The PDF Focus .Net perfectly works in 32/64-bit applications under .Net 2.0 and above. It can be easily launched in Medium trust level.

The library has powerfull and simple methods to export PDF to Word. It allows to:

  • Read PDF documents from Url, file, MemoryStream, bytes array
  • Get Word (RTF) document from PDF as physical file or string object in memory
  • Convert a whole PDF or only custom pages to Word

Here we'll show you some examples of using PDF Focus .Net to:

1. Convert PDF file to Word file in C#:

            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();	    	
            f.OpenPdf(@"d:\History.pdf");

            if (f.PageCount > 0)
            {
                int result = f.ToWord(@"d:\History.rtf");
                
                //Open Word document
                if (result==0)
                {
                    System.Diagnostics.Process.Start(@"d:\History.rtf");
                }
            }
      
2. Convert PDF to RTF in memory using C#:
            byte[] pdf = File.ReadAllBytes(@"c:\Book.pdf");

            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.OpenPdf(pdf);

            if (f.PageCount > 0)
            {
                f.WordOptions.Format = SautinSoft.PdfFocus.CWordOptions.eWordDocument.Rtf;
                string word = f.ToWord();
                //now the variable 'word' contains RTF document
            }

      
3. Convert 2nd-3rd pages of PDF document Word in VB.Net:
        Dim f As New SautinSoft.PdfFocus()
        f.OpenPdf("http://somesite.com/forprint.pdf")

        If f.PageCount > 2 Then
            'Convert only pages 2 - 3 to Word
            Dim result As Integer = f.ToWord("f:\foredit.doc", 2, 3)

            'Show Word document
            If result = 0 Then
                System.Diagnostics.Process.Start("f:\foredit.doc")
            End If
        End If

      
4. Export PDF to Word in ASP.Net-C#:
        SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
        f.OpenPdf(FileUpload1.FileBytes);

        if (f.PageCount > 0)
        {
            //Let's whole PDF document to Word (RTF)
            rtf = f.ToWord();
        }

        //show Word/rtf
        if (rtf != "")
        {
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = "application/msword";
            Response.AddHeader("Content-Disposition:", "attachment; filename=Result.doc");
            Response.Write(rtf);
            Response.Flush();
            Response.End();
        }
      
5. Convert PDF file to Word file in VB.Net:
        Dim f As New SautinSoft.PdfFocus()
        f.OpenPdf("c:\Simple Text.pdf")

        If f.PageCount > 0 Then
            Dim result As Integer = f.ToWord("c:\Result.doc")

            'Show Word document
            If result = 0 Then
                System.Diagnostics.Process.Start("c:\Result.doc")
            End If
        End If
If anyone needs a code sample in C#, VB.Net, ASP.Net etc "How to convert PDF to Word, RTF", email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page). We'll help you certainly!

   

Home | Contact | Privacy

Copyright © 2002 - 2012, SautinSoft (started from sautin.com). All rights reserved.