Question about Image Size.

back to home  >  Tech FAQ  >  Images in different size to PDF Document in C#


Hi, I have some images with different size. Some of them may be 2000X2000 pixel, and some of them may be 50X50. And I want to add these images to a PDF document, is it possible?

---- Jarvis


Hi, Jarvis.

Of course, you can insert your images to a PDF file using pqScan .net image to PDF SDK. And you can choose the page size of PDF you want to insert. Both original image size mode and a standard PDF layout mode(such A4) are OK.

If you choose original image size mode, the PDF page will display as your image's size. So if the original images size are not the same, the PDF pages rendered will display in different size.

If you choose to A4 mode, all the PDF pages will display as the A4 size. Please note that, if your image is too large or too small, the appearance of PDF page will be distortion in this mode. So we recommend you to convert images with similar size.

Here we give a sample to show you how to set PDF page size in C# code :

using System;
using System.Drawing;
using PQScan.ImageToPDF;

namespace ImageToPDFQuestion
    class Program
        static void Main(string[] args)
            //new a PDF converter object.
            PDFConverter converter = new PDFConverter();

            //set PDF page layout as input image size
            converter.PageSizeType = PageSizeMode.ImageSize;

            //set PDF page layout as A4 mode.
            converter.PageSizeType = PageSizeMode.A4;

            //add different size jpeg images to translating image list.
            string[] jpgImage = new string[2] { "size1.jpeg", "size2.jpeg" };

            //set output PDF name
            string fileName = "result.pdf";

            //turn images to PDF document.
            converter.CreatePDF(jpgImage, fileName);       

Hope the C# code can be helpful.

---- pqScan Support Team

Online Demo Download Trial How to Encode QR Code with Chinese Words in C# ? How to Insert Barcode Control to MS Excel WorkSheetin C# ? How to Add Barcode Image to MS Excel in C# ? How can I Create Barcode to Crystal Report in Visual Studio ? Can I Read Barcode in PDF document using C#? Can I Get a Compression Jpeg Image from PDF ? Merge A Group of Multi-page Tiff to PDF documentusing C#? Translate JPG Image to PDF document in C#? Convert specific pages from PDF to images in C# Is it available for reading all of the barcode in a picture by one time? Do You Support Translate Images to PDF from SQL Database?