PDF to Image - pqScan.com
C# Image to PDF Conversion Guide How to Use .NET Image to PDF Library to Add Image to PDF Document Using C# Online Demo Download Trial Purchase Now
C#.NET
VB.NET

How to Convert Image to PDF in C# .NET?

back to home  >  .NET Image to PDF SDK  >  How to Convert Image to PDF in .NET  >  Convert Image to PDF Using C# Class Code

pqScan Image to PDF conversion library is a .NET SDK which can transform most of raster image formats like TIFF, BMP, JPG, PNG and GIF into Adobe PDF file format. It empowers C# programmers to convert one single page image to one PDF page and convert multi-page Tiff/Tif image to multi-page PDF document. For detailed programming guide for multi-page file conversion, please see online article: turning multi-page tiff to PDF document in C#.

When generating a new PDF from images, C# developers can use specific APIs to choose desired page size for PDF document. If ImageSize type is selected, the converted PDF page size will be the same as input image source. If choosing the type to match your PDF page layout, like most commonly used A4, your input image will be automatically resized and scaled.

Now, we will provide you with C#.NET coding solutions for converting image to PDF document.

Image to PDF - C# Programming Sample

The first free coding sample explains how to transform images and add them into PDF document in Visual Studio C# .NET application. Developers can choose to change one image or a few image files to PDF document. Now, we will convert JPEG/JPG images on local disk to PDF for illustration.

using System;
using PQScan.ImageToPDF;

namespace ImageToPDF
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create an instance of PQScan.ImageToPDF.PDFConverter object.
            PDFConverter converter = new PDFConverter();

            // Set PDF page layout. A4 is the most widely used one.
            converter.PageSizeType = PageSizeMode.A4;

            // Set input images from local files.
            string[] imgFiles = newstring[3] { "input1.jpg", "input2.jpeg", "input3.jpg" };            

            // Set output PDF file name.
            string outFile = "jpeg-to-pdf.pdf";

            // Generate PDF from input images.
            converter.CreatePDF(imgFiles, outFile);
        }
    }
}

The second sample will tell developers how to convert PNG images from file stream to PDF document using C#.NET class code.

using System;
using System.IO;
using PQScan.ImageToPDF;

namespace ImageToPDF
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create an instance of PQScan.ImageToPDF.PDFConverter object.
            PDFConverter converter = new PDFConverter();

            // Set PDF page layout. If set to ImageSize, 
            // PDF page will keep the original size and quality of source image.
            converter.PageSizeType = PageSizeMode.ImageSize;

            // Set input images from file streams.
            FileStream[] streams = newFileStream[3];
            streams[0] = newFileStream("input1.png", FileMode.Open);
            streams[1] = newFileStream("input2.png", FileMode.Open);
            streams[2] = newFileStream("input3.png", FileMode.Open);           

            // Give a name to output PDF document.
            string outFile = "png-to-pdf.pdf";

            // Create PDF from loaded image files.
            converter.CreatePDF(streams, outFile);
        }
    }
}

convert image(jpg, png, tiff, bitmap, gif) to pdf in c#

Image to PDF Append to PDF in C# Tiff to PDF in C# Mixed Type to PDF in C#
I just want to inform you of how much I love your product. Absolute miracle, innovative! It solved my problem. You just win yourself a lifetime customer. Thanks you! Dylan Napier