Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
||||||||||||||||||||||||||







Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
There has been a lot of requests for code snippets that would do TIFF-to-PDF and PDF-to-TIFF conversions. In this article, we will see TIFF-to-PDF conversion using PDFOne .NET.
Unlike a BMP or JPEG image, TIFF is a container for multiple images. Using a TIFF viewer application such as Windows Picture and Fax Viewer or IrfanView, you can browse the individual frames. For a TIFF-to-PDF conversion, we need to extract the individual frames and render them on a page that is the same size as the frame. The following code example shows you how.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Gnostice.PDFOne;
using System.Drawing.Imaging;
namespace PDFOne_dotNET_Examples {
class Multipage_TIFF_To_PDF {
static void Main(string[] args) {
int i, n;
// Load the TIFF image
Bitmap bmp = new Bitmap("sample_doc.tiff");
// Find number of frames is the TIFF image
n = bmp.GetFrameCount(FrameDimension.Page);
PDFPage pg;
PDFDocument doc = new PDFDocument("your-license-key");
// Create a PDF page for each frame in the TIFF
for (i = 0; i < n; i++) {
// Active current frame
bmp.SelectActiveFrame(FrameDimension.Page, i);
// Create a PDF page with the same dimensions as the current TIFF frame
pg = new PDFPage(bmp.Width/96, // Assuming current
bmp.Height/96, // DPI is 96
PDFMeasurementUnit.Inches);
// Render the current frame on the new page
pg.DrawImage(bmp, 0f, 0f);
// Add the page to document
doc.AddPage(pg);
}
// Save the PDF document to file
doc.Save("sample_doc.pdf");
doc.Close();
}
}
}
Please note that we have another article for PDF-to-TIFF conversion.
---o0O0o---
| Our .NET Developer Tools | |
|---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
| Our Delphi/C++Builder developer tools | |
|---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
|
| Our Java developer tools | |
|---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
| Our Platform-Agnostic Cloud and On-Premises APIs | |
|---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
| Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2026 Gnostice Inc. All rights reserved. |