Create a PDF from a TIFF file

The code below shows you how to use the ImagePrintProvider class to convert a TIFF file to a PDF.

This sample requires a Tools license.

C#
using System;
using System.IO;
using SolidFramework.Plumbing;
using SolidFramework.Pdf.Creators;
using SolidFramework.Pdf;
using SolidFramework.Pdf.Creators.Plumbing;

namespace TIFFtoPDF
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Call your Solid Documents License
            SolidFramework.License.Import(@"C:\MyFolder\license.xml");

            // Set the location of your the file you want to convert
            String pdfPath = @"C:\YourFolder\yourpdf.tif";

            //*TIFF to PDF*//
            using (ImagePrintProvider imagePrintProvider = new ImagePrintProvider())
            {
                // Set the type of Image Optimization
                imagePrintProvider.Optimize = Optimize.Professional;

                // Add the source file
                imagePrintProvider.Print(pdfPath);

                // Create a PDF document object
                PdfDocument document = imagePrintProvider.PdfCreator.PdfDocument;

                // Set the output path and the file type
                document.Path = Path.ChangeExtension(pdfPath, ".pdf");

                // Convert and Save the file
                document.Save(OverwriteMode.ForceOverwrite);
            }
        }
    }
}

C++

VB.Net
Imports System.IO
Imports SolidFramework.Plumbing
Imports SolidFramework.Pdf


Module TIFFtoPDF

    Sub Main()

        ' Call your Solid Documents License
        SolidFramework.License.Import("C:\MyFolder\license.xml")

        'Define a variable for your source file
        Dim sPdfPath As String

        ' Define a PDF Document 
        Dim myDocument As SolidFramework.Pdf.PdfDocument

        ' Define your Solid Framework Converter
        Dim myConverter As SolidFramework.Pdf.Creators.ImagePrintProvider

        ' Set your file path 
        sPdfPath = "C:\YourFolder\filepdf.pdf"

        ' Set the converter
        myConverter = New SolidFramework.Pdf.Creators.ImagePrintProvider

        ' Set the PDF Document
        myDocument = New PdfDocument

        'Set the preferred conversion properties 

        ' Set the type of Image Optimization
        myConverter.Optimize = Creators.Plumbing.Optimize.Professional

        'Add the source file
        myConverter.Print(sPdfPath)

        ' Create a PDF document object
        myDocument = myConverter.PdfCreator.PdfDocument

        ' Set the output path and the file type
        myDocument.Path = Path.ChangeExtension(sPdfPath, ".pdf")

        'Convert and Save the file
        myDocument.Save(OverwriteMode.ForceOverwrite)

        ' Clean up
        myDocument.Dispose()

    End Sub

End Module