New to Telerik Document Processing? Download free 30-day trial

Converting Multi-page TIFF Images to PDF


Version Product Author
2024.2.426 RadPdfProcessing Desislava Yordanova


A common requirement is to generate a PDF document from a multi-page TIFF file. This article demonstrates a sample approach how to achieve it, ensuring the entire TIFF image fits onto the PDF page without any content being cut off.


To prevent TIFF images from being cut off when converted to PDF, consider creating a list of images from the TIFF frames. Then, adjust the PDF page dimensions to fit the image size. Here's a step-by-step guide:

  1. Convert the TIFF image to individual JPEG or PNG images. Ensure each image size matches the TIFF frame size to avoid scaling issues.
  2. Create a new RadFixedDocument, setting the page size based on the image dimensions.
  3. Use RadFixedDocumentEditor to add the images to the document pages, ensuring each image fits the page.
  4. Export the document to PDF format using PdfFormatProvider.

Below is a code snippet demonstrating this process:

static void Main(string[] args)
    string tiffFilePath = "test4.tif";
    string imageFolderPath = @"..\..\Images";
    System.Windows.Size pageSize = CreatedImages(tiffFilePath, imageFolderPath);
    GeneratePdfFromImagesWithRadFixedDocumentEditor(imageFolderPath, pageSize);

private static System.Windows.Size CreatedImages(string file, string imageFolderPath)
    int offset = 5;
    System.Windows.Size pageSize = new System.Windows.Size(100, 100);
    List<Image> images = new List<Image>();
    Bitmap bitmap = (Bitmap)Image.FromFile(file);
    int count = bitmap.GetFrameCount(FrameDimension.Page);
    string tempImg = string.Empty;
    for (int idx = 0; idx < count; idx++)
        bitmap.SelectActiveFrame(FrameDimension.Page, idx);
        MemoryStream byteStream = new MemoryStream();
        bitmap.Save(byteStream, ImageFormat.Tiff);
        if (bitmap.Width > pageSize.Width )
            pageSize = new System.Windows.Size(bitmap.Width+ offset, pageSize.Height);
        if (bitmap.Height > pageSize.Height)
            pageSize = new System.Windows.Size(pageSize.Width, bitmap.Height + offset);
        tempImg = imageFolderPath+@"\img" + idx + ".jpeg";
        bitmap.Save(tempImg, ImageFormat.Jpeg);
    return pageSize;
private static void GeneratePdfFromImagesWithRadFixedDocumentEditor(string imageFolderPath, System.Windows.Size pageSize)
    Padding pageMarginsValue = new Padding(
    RadFixedDocument fixedDocument = new RadFixedDocument();
    RadFixedDocumentEditor documentEditor = new RadFixedDocumentEditor(fixedDocument);
    documentEditor.SectionProperties.PageSize = pageSize;
    documentEditor.SectionProperties.PageMargins = pageMarginsValue;
    string[] imageFiles = Directory.GetFiles(imageFolderPath);

    foreach (string imageFilePath in imageFiles)
        FileStream fileStream = new FileStream(imageFilePath, FileMode.Open);
        Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource _imageSource =
            new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(fileStream);

    PdfFormatProvider provider = new PdfFormatProvider();
    string outputFilePath = @"..\..\sample.pdf";
    using (Stream output = File.OpenWrite(outputFilePath))
        provider.Export(fixedDocument, output);

This approach ensures the TIFF images are converted to PDF format without any part being cut off. The key is to adjust the document's page size to match the image dimensions.


  • The conversion process involves saving each TIFF frame as a separate image (JPEG or PNG) to accurately size the document pages.
  • The offset variable adds a margin around the image to ensure it fits comfortably on the page without touching the edges.

See Also

In this article