VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
In This Topic
    Codecs: How to convert TIFF to PDF?
    In This Topic
    VintaSoft Imaging .NET SDK allows to convert TIFF file to a PDF document using class DocumentConverter, ImageCollection or PdfDocument. Usage of DocumentConverter class provides the best performance because DocumentConverter class uses multi-threading.

    Here is C#/VB.NET code that shows how to convert TIFF file to PDF document using DocumentConverter class:
    /// <summary>
    /// Converts TIFF file to a PDF document using Vintasoft.Imaging.DocumentConverter class.
    /// </summary>
    public static void ConvertTiffToPdf_DocumentConverter(string tiffFileName, string pdfFileName)
    {
        Vintasoft.Imaging.DocumentConverter.Convert(tiffFileName, pdfFileName);
    }
    
    ''' <summary>
    ''' Converts TIFF file to a PDF document using Vintasoft.Imaging.DocumentConverter class.
    ''' </summary>
    Public Shared Sub ConvertTiffToPdf_DocumentConverter(tiffFileName As String, pdfFileName As String)
        Vintasoft.Imaging.DocumentConverter.Convert(tiffFileName, pdfFileName)
    End Sub
    


    Here is C#/VB.NET code that shows how to convert TIFF file to PDF document using ImageCollection class:
    public static void ConvertTiffToPdf_ImageCollection(string tiffFileName, string pdfFileName)
    {
        // create image collection
        using (Vintasoft.Imaging.ImageCollection imageCollection = 
            new Vintasoft.Imaging.ImageCollection())
        {
            // add TIFF file to collection
            imageCollection.Add(tiffFileName);
            // create TiffEncoder
            using (Vintasoft.Imaging.Codecs.Encoders.PdfEncoder pdfEncoder = 
                new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true))
            {
                // set PDF compression to Zip
                pdfEncoder.Settings.Compression = 
                    Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Zip;
                // add pages of TIFF file to PDF document use PDF encoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder);
            }
        }
    }
    
    Public Shared Sub ConvertTiffToPdf_ImageCollection(tiffFileName As String, pdfFileName As String)
        ' create image collection
        Using imageCollection As New Vintasoft.Imaging.ImageCollection()
            ' add TIFF file to collection
            imageCollection.Add(tiffFileName)
            ' create TiffEncoder
            Using pdfEncoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
                ' set PDF compression to Zip
                pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Zip
                ' add pages of TIFF file to PDF document use PDF encoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder)
            End Using
        End Using
    End Sub
    


    Here is C#/VB.NET code that shows how to convert TIFF file to PDF document using PdfDocument and TiffFile classes:
    public static void ConvertTiffToPdf_PdfDocument(string tiffFileName, string pdfFileName)
    {
        // open existing TIFF File
        using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(tiffFileName))
        {
            // create new PdfDocument, version 1.4
            using (Vintasoft.Imaging.Pdf.PdfDocument pdfDocument = 
                new Vintasoft.Imaging.Pdf.PdfDocument(
                    pdfFileName,
                    System.IO.FileMode.Create,
                    System.IO.FileAccess.ReadWrite,
                    Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
            {
                // for each TIFF page
                for (int i = 0; i < tiffFile.Pages.Count; i++)
                {
                    // add TIFF page to PDF document
                    pdfDocument.Pages.Add(tiffFile.Pages[i].GetImage(), 
                        Vintasoft.Imaging.Pdf.PdfCompression.Zip);
                    // save changes to a file
                    pdfDocument.SaveChanges();
                }
            }
        }
    }
    
    Public Shared Sub ConvertTiffToPdf_PdfDocument(tiffFileName As String, pdfFileName As String)
        ' open existing TIFF File
        Using tiffFile As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(tiffFileName)
            ' create new PdfDocument, version 1.4
            Using pdfDocument As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14)
                ' for each TIFF page
                For i As Integer = 0 To tiffFile.Pages.Count - 1
                    ' add TIFF page to PDF document
                    pdfDocument.Pages.Add(tiffFile.Pages(i).GetImage(), Vintasoft.Imaging.Pdf.PdfCompression.Zip)
                    ' save changes to a file
                    pdfDocument.SaveChanges()
                Next
            End Using
        End Using
    End Sub