Convert TIFF to PDF
The code below shows you how to use to convert TIFF images into a fully searchable PDF.
It is recommended that you have already reviewed the Getting Started sample, since that includes Licensing and Framework initialization code required to make this sample run.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using SolidFramework.Pdf.Creators;
using SolidFramework.Pdf.Creators.Plumbing;
using SolidFramework.Plumbing;
namespace CSharp_Tutorials
{
public static partial class Tutorials
{
public static bool ConvertTiffToPdf(string tiffPath, string outputPath)
{
// Create an ImagePrintProvider
using (var imagePrintProvider = new ImagePrintProvider())
{
// Set the type of image optimization to use
imagePrintProvider.Optimize = Optimize.Professional;
// Add the PDF file to convert
imagePrintProvider.Print(tiffPath);
// Get the printed PdfDocument
var document = imagePrintProvider.PdfCreator.PdfDocument;
// Save the printed PdfDocument
document.Save(OverwriteMode.ForceOverwrite);
}
Console.WriteLine("Successfully converted " + tiffPath + " to " + outputPath);
Console.WriteLine();
return true;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Imports System
Imports SolidFramework.Pdf
Imports SolidFramework.Pdf.Creators
Imports SolidFramework.Pdf.Creators.Plumbing
Imports SolidFramework.Plumbing
Namespace VBNet_Tutorials
Partial Module Tutorials
Function ConvertTiffToPdf(ByVal tiffPath As String, ByVal outputPath As String) As Boolean
' Create an ImagePrintProvider
Using imagePrintProvider As ImagePrintProvider = New ImagePrintProvider()
' Set the type of image optimization to use
imagePrintProvider.Optimize = Optimize.Professional
' Add the PDF file to convert
imagePrintProvider.Print(tiffPath)
' Get the printed PdfDocument
Dim document As PdfDocument = imagePrintProvider.PdfCreator.PdfDocument
' Save the printed PdfDocument
document.Save(OverwriteMode.ForceOverwrite)
End Using
Console.WriteLine("Successfully converted " & tiffPath & " to " & outputPath)
Console.WriteLine()
Return True
End Function
End Module
End Namespace
This sample is not currently available for C++.