How to Start Tutorials Troubleshooting Main Operations Convert PDF Read PDF Edit PDF PDF Report Generator Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF Converter Library
How to create, convert, export PDF from/to other file formats in C# ASP.NET .NET, MVC, Windows application. Free download


How to Use C#.NET XDoc.PDF Component to Convert PDF Document to Various Document and Image Forms in Visual C# .NET Application



RasterEdge XDoc.PDF for .NET is a powerful PDF file conversion library for C#/VB.NET ASP.NET Core, framework, and Windows application. In this C# PDF tutorial will guide you how to build a PDF converter in your C# ASP.NET web application, and websites. We will develop a PDF to multiple file formats converter ASP.NET Core web application.

Using PDF C# converter library we will:

  • Convert PDF file to Word (.docx) Office document, multi-page tiff image, svg web pages, text file and JPG, png raster image files
  • Apply scanned PDF to editable PDF/Word document



Download and Install XDoc.PDF C# library



  1. Download XDoc.PDF Converter C# library
  2. Install C# library to convert PDF pages to other file formats
  3. Step by Step Tutorial






Convert PDF to other file formats using C#



How to convert PDF files to word, tiff, svg, image files? It is very easy job to convert PDF file in C# using XDoc.PDF.

We could simply use class PDFDocument conversion methods to export PDF document to Microsoft Word (.docx), tiff, JPG image files in a single method.



Convert to Word (.docx)

The following C# source code will tell you how to use XDoc.PDF SDK to convert PDF document to Microsoft Word document.

  • Load a PDF file to construct a PDFDocument object
  • Utilize method ConvertToDocument() to convert PDF to .docx file

            PDFDocument doc = new PDFDocument(@"C:\demo.pdf");
            doc.ConvertToDocument(DocumentType.DOCX, @"C:\output.docx");


You can also easily convert scanned PDF to editable Word document using XDoc.PDF and OCR C# library. View step by step guides at How to convert scanned pdf to word .docx using C#



Convert to multi-page TIFF image

The C# code below offers you a piece of C# demo code to convert PDF to multi-page TIFF image file. You may directly copy and paste it into your C# testing project.

            //  Open file
            PDFDocument doc = new PDFDocument(@"W:\Projects\Test-Files\file1.pdf");
            //  Convert whole PDF document to TIFF file
            doc.ConvertToDocument(DocumentType.TIFF, @"W:\Projects\Test-Output\demo.tif");


You could customize the converted TIFF image file with the following image options

  • Color: the converted TIFF image color setting
  • Compression: the tiff image compression scheme
  • Resolution: the TIFF image resolution setting
  • Zoom: use more pixel to render the PDF page if needed.



Please find the details here: How to convert PDF to multiplage TIFF file in C# with advanced image options?



Convert to SVG, HTML web pages

Like other file conversion, you can use method PDFDocument.ConvertToVectorImages() to convert PDF to SVG files directly using C# code. Every PDF page will be converted to one SVG file.

            PDFDocument doc = new PDFDocument(@"W:\Projects\Test-Files\file1.pdf");
            doc.ConvertToVectorImages(ContextType.SVG, @"W:\Projects\Test-Output\pdf-convert-pdf-to-svg\", "file1-", RelativeType.SVG);


You can apply the following option to customize the converted SVG vector image files.

  • RelativeType : embed image resource files, font resource files, and other files inside the SVG file or not



Please find more explanation here: How to convert PDF to SVG files in C#?



Convert to Text file (.txt)

To convert PDF to text file in C#, you may need apply right text encoding format. The following C# sample source code show how to convert PDF text content to a .txt file with UTF8 character encoding.

            using (Stream inStream = File.Open(@"W:\Projects\Test-Files\unicode-test-file.pdf", FileMode.Open, FileAccess.Read))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    //  Convert PDF to TXT from file stream to memory stream.
                    DocumentConverter.ToDocument(inStream, ms, FileType.DOC_TXT);

                    //  Get String from the data bytes (in UTF-8)
                    String content = Encoding.UTF8.GetString(ms.ToArray());

                    //  Get data bytes (in Unicode) from String.
                    byte[] dataBytes = Encoding.Unicode.GetBytes(content);
                    //  ...
                }
            }


Convert to JPG, PNG, bitmap images

You could also easily convert each PDF pages to one JPG, PNG, bitmap image file in C#.

            PDFDocument doc = new PDFDocument(@"W:\Projects\Test-Files\test-file.pdf");
            doc.ConvertToImages(ImageType.JPEG, @"W:\Projects\Test-Output\pdf-convert-pdf-to-jpg\", "test-file");


To apply the image convert options, such as color, resolution, image compression mode, please view details here:
How to convert PDF to JPG images in C#?
How to convert PDF to PNG images in C#?
How to convert PDF to bitmap images in C#?
How to convert PDF to raster images in C#?



Conclusion

In this tutorial we have provided ways to convert Adobe PDF document to multiple other file formats, including Microsoft Office Word (.docx), TIFF image file, SVG, HTML web pages, text file, and JPG, PNG, bitmap raster image files. Certain file formats have advanced convert options, you can view the detailed pages listed in the above content.

Every developer can use XDoc.PDF C# library to build PDF converter application within .NET projects.