This C# sample takes a local PDF as an input file and shows how to use well-developed .NET APIs to convert PDF file to TIFF images in C#.NET using PDF to image converter SDK.
using System; using System.Drawing; using System.Drawing.Imaging; using PQScan.PDFToImage; namespace PDF2TIFF { class Program { static void Main(string[] args) { // Create an instance of PQScan.PDFToImage.PDFDocument object. PDFDocument pdfDoc = new PDFDocument(); // Load a local PDF file. pdfDoc.LoadPDF("sample.pdf"); // Obtain the total page count. int count = pdfDoc.PageCount; for (int i = 0; i < count; i++) { // Turn PDF file page to image. Bitmap tifImage = pdfDoc.ToImage(i); // Save image as tiff image file type. tifImage.Save("output" + i + ".tiff", ImageFormat.Tiff); } } } }
This Visual C# coding example tells you how to implement rapid file conversion to TIFF image from PDF file stream. You are empowered to resize the output Tiff image in this free demo.
using System; using System.IO; using System.Drawing; using System.Drawing.Imaging; using PQScan.PDFToImage; namespace PDFToTIF { class Program { static void Main(string[] args) { // Make a new instance of PQScan.PDFToImage.PDFDocument object. PDFDocument pdf = new PDFDocument(); // Create a file stream with PDF message. FileStream stream = new FileStream("sample.pdf", FileMode.Open); // Load PDF from file stream. pdf.LoadPDF(stream); // Set output tif image width. int width = pdf.GetPageWidth(0) / 2; // Set output tif image height. int height = pdf.GetPageHeight(0) / 2; // Convert the first PDF page to image with the desired size. Bitmap tif = pdf.ToImage(0, width, height); // Save image to tif format. tif.Save("result.tiff", ImageFormat.Tiff); } } }
Besides the free sample codes above, there is a useful guide about how to get desired size image from PDF using C#.