Convert PDF files to 300-dpi TIFF files in C# and .NET
Document processing is an important part of automating business processes, archiving, and information exchange. One common task is converting PDF files to a raster image format, such as TIFF, for more versatile display, archiving, or transmission.
In this article, we'll explore how to automatically convert PDFs to TIFFs with 300 dpi technology using the PDF Focus .NET component of the powerful SautinSoft library in C# and .NET. We'll identify the benefits of this integration, discuss its application scenarios, and provide sample code that implements this solution.
This tool is useful in a variety of scenarios:
- Archiving: Saving documents in raster format for long-term storage.
- Scanned documents: Converting PDFs to TIFFs for OCR compatibility.
- Data transfer: When external systems require high resolution.
- Image processing: Preparing documents for graphic editors or automated analysis.
DPI (dots per inch) is the number of dots per inch. This resolution level is considered the high-quality standard in printing and services:
- File size – larger than lower resolutions, but ensures clear readability of text and details.
- Adaptation for professional purposes such as publishing, publication archiving, and OCR.
Key advantages of the code:
- Automatic processing of multiple pages.
- Ability to specify resolution (DPI).
- Conversion to TIFF – one or more images, combined into a single file or saved separately.
- Easy integration into any project.
Practical application and popularity.
Using such scripts and solutions in business processes is a fairly common practice, especially in organizations that value automation and quality of
document processing. In legal, medical, and archival institutions, similar regulations are regularly applied.
Furthermore, automatic PDF to TIFF conversion helps minimize manual effort, increase processing speed, and ensure compatibility with text recognition
(OCR) engines.
Complete code
using System;
using System.IO;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
// Before starting, we recommend to get a free key:
// https://sautinsoft.com/start-for-free/
// Apply the key here:
// SautinSoft.PdfFocus.SetLicense("...");
//Convert PDF files to 300-dpi JPG files
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string[] pdfFiles = Directory.GetFiles(@"..\..\..\", "*.pdf");
string folderWithJPGs = new DirectoryInfo(Directory.GetCurrentDirectory()).CreateSubdirectory("Result").FullName;
foreach (string pdffile in pdfFiles)
{
f.OpenPdf(pdffile);
if (f.PageCount > 0)
{
//Set image format: Jpeg, 300 dpi
f.ImageOptions.Dpi = 300;
f.ImageOptions.ImageFormat = SautinSoft.PdfFocus.CImageOptions.ImageFormats.Jpeg;
//Save all pages to jpeg files with 300 dpi
f.ToImages(folderWithJPGs, Path.GetFileNameWithoutExtension(pdffile));
}
f.ClosePdf();
}
//Show folder with jpegs
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(folderWithJPGs) { UseShellExecute = true });
}
}
}
Imports System
Imports System.IO
Namespace Sample
Friend Class Sample
Shared Sub Main(ByVal args() As String)
' Before starting, we recommend to get a free key:
' https://sautinsoft.com/start-for-free/
' Apply the key here:
' SautinSoft.PdfFocus.SetLicense("...");
'Convert PDF files to 300-dpi JPG files
Dim f As New SautinSoft.PdfFocus()
Dim pdfFiles() As String = Directory.GetFiles("..\..\..\", "*.pdf")
Dim folderWithJPGs As String = (New DirectoryInfo(Directory.GetCurrentDirectory())).CreateSubdirectory("Result").FullName
For Each pdffile As String In pdfFiles
f.OpenPdf(pdffile)
If f.PageCount > 0 Then
'Set image format: Jpeg, 300 dpi
f.ImageOptions.Dpi = 300
f.ImageOptions.ImageFormat = SautinSoft.PdfFocus.CImageOptions.ImageFormats.Jpeg
'Save all pages to jpeg files with 300 dpi
f.ToImages(folderWithJPGs, Path.GetFileNameWithoutExtension(pdffile))
End If
f.ClosePdf()
Next pdffile
'Show folder with jpegs
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(folderWithJPGs) With {.UseShellExecute = True})
End Sub
End Class
End Namespace
If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: