VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
In This Topic
Codecs: How to convert TIFF to PDF/A?
In This Topic
VintaSoft Imaging .NET SDK allows to convert TIFF file to a PDF/A 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/A document using DocumentConverter class:
/// <summary>
/// Converts TIFF file to a PDF/A document using Vintasoft.Imaging.DocumentConverter class.
/// </summary>
public static void ConvertTiffToPdfA_DocumentConverter(string tiffFileName, string pdfFileName)
{
    Vintasoft.Imaging.Codecs.Encoders.PdfEncoderSettings settings = new Vintasoft.Imaging.Codecs.Encoders.PdfEncoderSettings();
    // set PDF/A-1b conformance
    settings.Conformance = Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b;
    // set default RGB ICC Profile filename
    settings.PdfADefaultRgbIccProfileFilename = "DefaultRGB.icc";

    Vintasoft.Imaging.DocumentConverter.ConvertToPdf(tiffFileName, pdfFileName, settings);
}
''' <summary>
''' Converts TIFF file to a PDF/A document using Vintasoft.Imaging.DocumentConverter class.
''' </summary>
Public Shared Sub ConvertTiffToPdfA_DocumentConverter(tiffFileName As String, pdfFileName As String)
    Dim settings As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoderSettings()
    ' set PDF/A-1b conformance
    settings.Conformance = Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b
    ' set default RGB ICC Profile filename
    settings.PdfADefaultRgbIccProfileFilename = "DefaultRGB.icc"

    Vintasoft.Imaging.DocumentConverter.ConvertToPdf(tiffFileName, pdfFileName, settings)
End Sub


Here is C#/VB.NET code that shows how to convert TIFF file to PDF/A document using ImageCollection and PdfEncoder classes:
public static void ConvertTiffToPdfA_ImageCollection(string tiffFileName, string pdfFileName)
{
    // create image collection
    Vintasoft.Imaging.ImageCollection imageCollection =
        new Vintasoft.Imaging.ImageCollection();
    
    // add PDF document to collection
    imageCollection.Add(tiffFileName);
    
    // create PdfEncoder
    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;
        
        // set PDF/A-1b conformance
        pdfEncoder.Settings.Conformance = Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b;
        
        // add pages of TIFF file to PDF document using PDF encoder
        imageCollection.SaveSync(pdfFileName, pdfEncoder);
    }

    // clear image collection
    imageCollection.ClearAndDisposeItems();
}
Public Shared Sub ConvertTiffToPdfA_ImageCollection(tiffFileName As String, pdfFileName As String)
    ' create image collection
    Dim imageCollection As New Vintasoft.Imaging.ImageCollection()

    ' add PDF document to collection
    imageCollection.Add(tiffFileName)

    ' create PdfEncoder
    Using pdfEncoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
        ' set PDF compression to Zip
        pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Zip

        ' set PDF/A-1b conformance
        pdfEncoder.Settings.Conformance = Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b

        ' add pages of TIFF file to PDF document using PDF encoder
        imageCollection.SaveSync(pdfFileName, pdfEncoder)
    End Using

    ' clear image collection
    imageCollection.ClearAndDisposeItems()
End Sub


Here is C#/VB.NET code that shows how to convert TIFF file to PDF/A document using PdfDocument and TiffFile classes:
public static void ConvertTiffToPdfA_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
    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
            using (Vintasoft.Imaging.VintasoftImage image = tiffFile.Pages[i].GetImage())
                pdfDocument.Pages.Add(image, Vintasoft.Imaging.Pdf.PdfCompression.Zip);

            // save changes to a PDF document
            pdfDocument.SaveChanges();
        }

        // convert document to PDF/A-1b
        pdfDocument.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b);
    }
}
Public Shared Sub ConvertTiffToPdfA_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
        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
                Using image As Vintasoft.Imaging.VintasoftImage = tiffFile.Pages(i).GetImage()
                    pdfDocument.Pages.Add(image, Vintasoft.Imaging.Pdf.PdfCompression.Zip)
                End Using

                ' save changes to a PDF document
                pdfDocument.SaveChanges()
            Next

            ' convert document to PDF/A-1b
            pdfDocument.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b)
        End Using
    End Using
End Sub