VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
Кодеки: Как конвертировать TIFF в PDF?
В этом разделе
VintaSoft Imaging .NET SDK позволяет конвертировать TIFF файл в PDF документ, используя класс DocumentConverter, ImageCollection или PdfDocument. Использование класса DocumentConverter обеспечивает наилучшую производительность, поскольку класс DocumentConverter использует многопоточность.

Вот C#/VB.NET код, который демонстрирует, как преобразовать TIFF файл в PDF документ с помощью класса DocumentConverter:
/// <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


Вот C#/VB.NET код, который демонстрирует, как преобразовать TIFF файл в PDF документ с помощью класса ImageCollection:
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


Вот C#/VB.NET код, который демонстрирует, как преобразовать TIFF файл в PDF документ с помощью классов PdfDocument и TiffFile:
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