Convert many TIFF files to PDF files in C# and VB.Net

Convert many TIFF files to PDF files
in C# and VB.Net.


Complete code

using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;

namespace Sample
{
    class Test
    {
        static void Main(string[] args)
        {
            // Convert many TIFF files to PDF files.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();

            DirectoryInfo inpFolder = new DirectoryInfo(@"..\..\");
            FileInfo[] inpFiles = inpFolder.GetFiles(@"*.tif*");
            DirectoryInfo outFolder = new DirectoryInfo(Directory.GetCurrentDirectory()).CreateSubdirectory("Results");

            foreach (FileInfo inpFile in inpFiles)
            {
                string pdfFile = Path.GetFileNameWithoutExtension(inpFile.FullName) + ".pdf";
                pdfFile = Path.Combine(outFolder.FullName, pdfFile);
                v.ConvertImageFileToPDFFile(inpFile.FullName, pdfFile);
            }
            // Open the resulting folder with the PDF documents.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFolder.FullName) { UseShellExecute = true });
        }
    }
}

Download.

        
            Imports System
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging

Namespace Sample
    Friend Class Test
        Shared Sub Main(ByVal args() As String)
            ' Convert many TIFF files to PDF files.
            Dim v As New SautinSoft.PdfVision()

            Dim inpFolder As New DirectoryInfo("..\..\")
            Dim inpFiles() As FileInfo = inpFolder.GetFiles("*.tif*")
            Dim outFolder As DirectoryInfo = (New DirectoryInfo(Directory.GetCurrentDirectory())).CreateSubdirectory("Results")

            For Each inpFile As FileInfo In inpFiles
                Dim pdfFile As String = Path.GetFileNameWithoutExtension(inpFile.FullName) & ".pdf"
                pdfFile = Path.Combine(outFolder.FullName, pdfFile)
                v.ConvertImageFileToPDFFile(inpFile.FullName, pdfFile)
            Next inpFile
            ' Open the resulting folder with the PDF documents.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFolder.FullName) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace

Download.


If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below:



Questions and suggestions from you are always welcome!

We are developing .Net components since 2002. We know PDF, DOCX, RTF, HTML, XLSX and Images formats. If you need any assistance with creating, modifying or converting documents in various formats, we can help you. We will write any code example for you absolutely free.