XDoc.PDF
Features
Tech Specs
How-to C#
Pricing
How to Start Convert PDF Read PDF Build PDF 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 to Tiff Converter Library
How to convert, export multipage PDF file to tiff images using C# in ASP.NET, Windows. Free open source demo code.


Online C# Tutorial for Converting PDF File to high quality Tiff Image File with .NET XDoc.PDF Control in C#.NET Class. Free Online Trial Download.










  • Best C#.NET PDF converter SDK for converting PDF to Tiff in Visual Studio .NET project
  • Powerful .NET converter control to batch convert PDF documents to tiff format in Visual C# .NET program
  • Free library are given for converting PDF to Tiff in both C# .NET WinForms and ASP.NET application
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Tiff files are exported with high resolution and no loss in quality in .NET framework
  • Both single page and multipages tiff image files can be created from PDF
  • Supports tiff compression selection
  • Supports for changing image size
  • Also supports convert PDF files to jpg, jpeg images
  • C# class source codes and online demos are provided for .NET


RasterEdge C#.NET PDF to TIFF converting library control (XDoc.PDF) is a multifunctional PDF document converting tool, which can perform high-fidelity PDF to TIFF conversion in an easy way. Using this .NET PDF to TIFF conversion control, C# developers can render and convert PDF document to TIFF image file with no loss in original file quality. Both single page and multi-page Tiff image files are acceptable.





How to convert PDF to Tiff with options using C#.NET


Using XDoc.PDF for .NET, you can easily convert multi-pages PDF file into tiff. The following Tiff document settings supported in class "ImageOutputOption":


  1. Color: Output image is Monochrome, Gray, Color.

  2. Compression: defines the compression scheme used on the image data in the output TIFF file. Valid values:
    Uncompressed: No compression used.
    PackBits: Using a simple byte-oriented run-length scheme.
    CCITT1D: Using CCITT Group 3 1-Dimensional Modified Huffman run-length encoding.
    Group3Fax: Using CCITT T.4 bi-level encoding.
    Group4Fax: Using CCITT T.6 bi-level encoding.
    LZW: Using Lempel-Ziv & Welch (LZW) algorithm.
    JPEG: Using JPEG baseline based on the Discrete Cosine Transform (DCT).

  3. Resolution: Set image resolution value in the JPEG file.



            String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
            String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-tiff.tif";

            ImageOutputOption options = new ImageOutputOption();
            //  Output image is color.
            options.Color = ColorType.Color;
            //  Use LZW compression in TIFF file.
            options.Compression = ImageCompress.LZW;
            //  Set resolution to 300 dpi for each page.
            options.Resolution = 300;

            //  Open file
            PDFDocument doc = new PDFDocument(inputFilePath);
            //  Convert whole document to TIFF file
            doc.ConvertToDocument(DocumentType.TIFF, outputFilePath, options);




C# convert, turn two or multiple pdf files to tiff (batch conversion)


        #region pdf to tiff (batch files and single tread)
        internal static void pdfFilesToTiff()
        {
            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
            foreach (String filePath in files)
            {
                int startIdx = filePath.LastIndexOf("\\");
                int endIdx = filePath.LastIndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                PDFDocument doc = new PDFDocument(filePath);
                doc.ConvertToDocument(DocumentType.TIFF, outputDirectory + docName + ".tif");
            }
        }
        #endregion

        #region pdf to tiff (batch files and multiple treads)
        internal static void pdffiles22Tiff()
        {
            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
            List<ConversionArgs> args = new List<ConversionArgs>();
            foreach (String filePath in files)
            {
                int startIdx = filePath.LastIndexOf("\\");
                int endIdx = filePath.LastIndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                ConversionArgs arg = new ConversionArgs(filePath, outputDirectory + docName + ".tif");
                args.Add(arg);
            }

            List<Thread> threads = new List<Thread>();
            foreach (ConversionArgs arg in args)
            {
                Thread thread = new Thread(pdfToTiffThread);
                thread.Start(arg);
            }
            foreach (Thread thread in threads)
            {
                thread.Join();
            }
        }

        private static void pdfToTiffThread(object args)
        {
            ConversionArgs toPdfArgs = (ConversionArgs)args;
            PDFDocument srcDoc = new PDFDocument(toPdfArgs.SrcPath);
            if (srcDoc != null)
            {
                srcDoc.ConvertToDocument(DocumentType.TIFF, toPdfArgs.DstPath);
                srcDoc.Dispose();
            }
        }
        #endregion




C# combine multiple pdf files, and convert to tiff


        #region combine and convert pdf to single tiff file
        internal static void combineAndConvertPdfToTiff()
        {
            String[] files = new String[] { @"C:\demo1.pdf", @"C:\demo2.pdf", @"C:\demo3.pdf" };
            String outputFilePath = @"C:\output.tif";
            List<MemoryStream> streams = new List<MemoryStream>();
            foreach (String file in files)
            {
                MemoryStream outputStream = new MemoryStream();
                PDFDocument doc = new PDFDocument(file);
                doc.ConvertToDocument(DocumentType.TIFF, outputStream);
                streams.Add(outputStream);
            }
            TIFFDocument.CombineDocument(streams.ToArray(), outputFilePath);
        }
        #endregion




C# insert pdf pages into tiff file and create a new tiff file


        #region insert pdf to tiff
        internal static void insertPdfToTiff()
        {
            String filePath = @"C:\demo.pdf";
            PDFDocument doc = new PDFDocument(filePath);
            MemoryStream stream = new MemoryStream();
            doc.ConvertToDocument(DocumentType.TIFF, stream);
            TIFFDocument tif = new TIFFDocument(stream);
            int pageCount = tif.GetPageCount();
            List<BasePage> pages = new List<BasePage>();
            for (int i = 0; i < pageCount; i++)
            {
                pages.Add(doc.GetPage(i));
            }
            String outputTif = @"C:\output.tif";
            TIFFDocument desDoc = new TIFFDocument(outputTif);
            int insertLocation = 2;
            desDoc.InsertPages(pages.ToArray(), insertLocation);
            desDoc.Save(@"C:\desDocumcnet.tif");
        }
        #endregion




C# convert pdf to tiff with specified dpi resolutions


        #region convert pdf file to Tiff with specified resolution
        internal static void convertPdfFileToTiffWithSpecified()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputFilePath = @"C:\demo.tif";
            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToDocument(DocumentType.TIFF, 300, outputFilePath);
        }
        #endregion




C# convert pdf to tiff with specified colorspace (color, grayscale, monochrome or black & white) settings


        #region convert pdf file to Tiff with specified colorspace settings
        internal static void convertPdfFileToTiffWithSpecifiedSettings()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputFilePath = @"C:\demo.tif";
            PDFDocument doc = new PDFDocument(inputFilePath);

            //set image output settings
            ImageOutputOption option = new ImageOutputOption();
            option.Color = ColorType.Monochrome;
            //...

            doc.ConvertToDocument(DocumentType.TIFF, outputFilePath, option);
        }
        #endregion