Aquileo | Class ImageToPdfConverter | C# PDF Library Documentation | IronPDF
Search Results for

    Show / Hide Table of Contents

    Class ImageToPdfConverter

    Converts images (PNG, JPG, BMP, GIF, TIFF, SVG) to professional PDF documents instantly. Perfect for digitizing scanned documents, photo albums, certificates, or creating image portfolios.

    // Single image to PDF:
    var pdf = ImageToPdfConverter.ImageToPdf("photo.jpg");
    pdf.SaveAs("photo.pdf");
    
    // Multiple images to multi-page PDF:
    string[] images = { "page1.png", "page2.jpg", "page3.tiff" };
    var document = ImageToPdfConverter.ImageToPdf(images);
    document.SaveAs("album.pdf");
    
    // From bitmap with custom behavior:
    using (var bitmap = AnyBitmap.FromFile("scan.png")) {
        var pdf = ImageToPdfConverter.ImageToPdf(bitmap,
            Imaging.ImageBehavior.CropPage);  // Exact size
    }

    Supports 20+ image formats including PNG, JPG, GIF, BMP, TIFF, SVG, WebP

    For PDF to image conversion, use PdfDocument.ToBitmap() instead

    See: https://ironpdf.com/how-to/image-to-pdf/

    Inheritance
    System.Object
    ImageToPdfConverter
    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public static class ImageToPdfConverter : Object

    Methods

    ImageToPdf(AnyBitmap, ImageBehavior, ChromePdfRenderOptions)

    Converts in-memory bitmap images to PDF without file I/O for maximum performance. Essential for processing generated images, screenshots, or modified graphics.

    // From generated chart:
    using (var chart = GenerateChart()) {
        var pdf = ImageToPdfConverter.ImageToPdf(chart);
        pdf.SaveAs("chart-report.pdf");
    }
    
    // Process screenshot:
    using (var screenshot = CaptureScreen()) {
        var pdf = ImageToPdfConverter.ImageToPdf(screenshot,
            Imaging.ImageBehavior.FitToPageAndMaintainAspectRatio);
        pdf.AddHeader("Screenshot taken: {date}");
        pdf.SaveAs("screenshot.pdf");
    }
    
    // Modified image:
    using (var original = AnyBitmap.FromFile("original.jpg")) {
        // Apply modifications...
        var pdf = ImageToPdfConverter.ImageToPdf(original);
        pdf.SaveAs("modified.pdf");
    }

    Always dispose AnyBitmap objects to prevent memory leaks

    CenteredOnPage default maintains original dimensions

    Declaration
    public static PdfDocument ImageToPdf(AnyBitmap image, ImageBehavior behavior, ChromePdfRenderOptions options = null)
    Parameters
    Type Name Description
    IronSoftware.Drawing.AnyBitmap image

    The image object. Requires a project reference to the IronSoftware.System.Drawing Assembly.

    ImageBehavior behavior

    Describes how image should be placed on the PDF page

    ChromePdfRenderOptions options

    Rendering options

    Returns
    Type Description
    PdfDocument

    Returns a PdfDocument document which can then be edited, saved or served over the web.

    Exceptions
    Type Condition
    System.NotSupportedException

    The file does not have a supported image format. Supported files: .apng, .avif, .bmp, .cur, .dib, .gif, .ico, .jfif, .jif, .jpe, .jpeg, .jpg, .pjp, .pjpeg, .png, .svg, .tif, .tiff, .webp

    System.IO.FileNotFoundException

    ImageToPdf(IEnumerable<AnyBitmap>, ImageBehavior, ChromePdfRenderOptions)

    Batch processes multiple in-memory bitmaps to create multi-page PDFs efficiently. Perfect for combining generated graphics, processed images, or dynamic visual content.

    // Generate report with multiple charts:
    var charts = new List<AnyBitmap>();
    foreach (var dataset in datasets) {
        charts.Add(GenerateChart(dataset));
    }
    var report = ImageToPdfConverter.ImageToPdf(charts);
    report.SaveAs("charts-report.pdf");
    // Remember to dispose bitmaps
    charts.ForEach(c => c.Dispose());
    
    // Process batch of screenshots:
    var screenshots = CaptureAllScreens();
    using (var pdf = ImageToPdfConverter.ImageToPdf(screenshots,
        Imaging.ImageBehavior.FitToPageAndMaintainAspectRatio)) {
        pdf.AddWatermark("SCREEN CAPTURE");
        pdf.SaveAs("all-screens.pdf");
    }
    
    // Combine processed images:
    var processed = images.Select(ApplyFilters).ToList();
    var portfolio = ImageToPdfConverter.ImageToPdf(processed);

    Use LINQ to transform images before conversion

    Dispose all AnyBitmap objects after conversion to free memory

    See: https://ironpdf.com/how-to/image-to-pdf/#in-memory-conversion

    Declaration
    public static PdfDocument ImageToPdf(IEnumerable<AnyBitmap> images, ImageBehavior behavior, ChromePdfRenderOptions options = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IronSoftware.Drawing.AnyBitmap> images

    The image objects. Requires a project reference to the IronSoftware.System.Drawing Assembly.

    ImageBehavior behavior

    Describes how image should be placed on the PDF page

    ChromePdfRenderOptions options

    Rendering options

    Returns
    Type Description
    PdfDocument

    Returns a PdfDocument document which can then be edited, saved or served over the web.

    Exceptions
    Type Condition
    System.NotSupportedException

    The file does not have a supported image format. Supported files: .apng, .avif, .bmp, .cur, .dib, .gif, .ico, .jfif, .jif, .jpe, .jpeg, .jpg, .pjp, .pjpeg, .png, .svg, .tif, .tiff, .webp

    System.IO.FileNotFoundException

    ImageToPdf(IEnumerable<String>, ImageBehavior, ChromePdfRenderOptions)

    Batch converts multiple images to a multi-page PDF document with one image per page. Ideal for creating photo albums, scanned document bundles, or presentation handouts.

    // Create photo album:
    var photos = Directory.GetFiles(@"C:\Photos", "*.jpg");
    var album = ImageToPdfConverter.ImageToPdf(photos);
    album.SaveAs("vacation-album.pdf");
    
    // Combine scanned pages:
    string[] scans = { "page1.tiff", "page2.tiff", "page3.tiff" };
    var document = ImageToPdfConverter.ImageToPdf(scans,
        Imaging.ImageBehavior.CropPage);  // Preserve exact scan dimensions
    
    // Mixed format portfolio:
    var images = new[] { "cover.png", "chart.svg", "photo.jpg" };
    var portfolio = ImageToPdfConverter.ImageToPdf(images);
    portfolio.AddWatermark("CONFIDENTIAL");
    portfolio.SaveAs("portfolio.pdf");

    Page order matches input array order - pre-sort if needed

    Large images may increase PDF size - consider compression

    See: https://ironpdf.com/examples/image-to-pdf-csharp/

    Declaration
    public static PdfDocument ImageToPdf(IEnumerable<string> imageFileNames, ImageBehavior behavior, ChromePdfRenderOptions options = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> imageFileNames

    The image file path names.

    ImageBehavior behavior

    Describes how image should be placed on the PDF page

    ChromePdfRenderOptions options

    Rendering options

    Returns
    Type Description
    PdfDocument

    Returns a PdfDocument document which can then be edited, saved or served over the web.

    Exceptions
    Type Condition
    System.NotSupportedException

    The file does not have a supported image format. Supported files: .apng, .avif, .bmp, .cur, .dib, .gif, .ico, .jfif, .jif, .jpe, .jpeg, .jpg, .pjp, .pjpeg, .png, .svg, .tif, .tiff, .webp

    System.IO.FileNotFoundException

    ImageToPdf(String, ImageBehavior, ChromePdfRenderOptions)

    Converts a single image file to a high-quality PDF document instantly. Automatically handles aspect ratio, orientation, and resolution for professional results.

    // Simple conversion:
    var pdf = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg");
    pdf.SaveAs("invoice.pdf");
    
    // Custom page layout:
    var options = new ChromePdfRenderOptions {
        PaperSize = PdfPaperSize.A4,
        MarginTop = 0, MarginBottom = 0,
        MarginLeft = 0, MarginRight = 0
    };
    var pdf = ImageToPdfConverter.ImageToPdf("certificate.png",
        Imaging.ImageBehavior.CropPage, options);
    
    // Fit to page with margins:
    var pdf = ImageToPdfConverter.ImageToPdf("diagram.svg",
        Imaging.ImageBehavior.FitToPageAndMaintainAspectRatio);

    CropPage creates exact image dimensions, FitToPage uses standard paper sizes

    SVG files are rendered at high quality regardless of size

    Declaration
    public static PdfDocument ImageToPdf(string imageFileName, ImageBehavior behavior, ChromePdfRenderOptions options = null)
    Parameters
    Type Name Description
    System.String imageFileName

    File path of the image file.

    ImageBehavior behavior

    Describes how image should be placed on the PDF page

    ChromePdfRenderOptions options

    Rendering options

    Returns
    Type Description
    PdfDocument

    Returns a PdfDocument document which can then be edited, saved or served over the web.

    Exceptions
    Type Condition
    System.NotSupportedException

    The file does not have a supported image format. Supported files: .apng, .avif, .bmp, .cur, .dib, .gif, .ico, .jfif, .jif, .jpe, .jpeg, .jpg, .pjp, .pjpeg, .png, .svg, .tif, .tiff, .webp

    System.IO.FileNotFoundException
      ☀
      ☾
      Downloads
      • Download with Nuget
      • Start for Free
      In This Article
      Back to top
      Install with Nuget
      IronPDF_for_dotnet_log2o
      Blue key in circleGet started for FREE
      No credit card required
      Test in a live environment

      Test in production without watermarks.
      Works wherever you need it to.

      Fully-functional product

      Get 30 days of fully functional product.
      Have it up and running in minutes.

      24/5 technical support

      Full access to our support engineering team during your product trial

      Grey key in circleGet started for FREE
      The trial form was submitted successfully.
      Calendar in circleBook Free Live Demo
      No contact, no card details, no commitments Book a 30-minute, personal demo.
      Here's what to expect:

      A live demo of our product and its key features

      Get project specific feature recommendations

      All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

      Grey key in circleBook Free Live Demo
      Your booking has been completed Check your e-mail for confirmation
      Support Team Member 6 related to The C# PDF LibrarySupport Team Member 14 related to The C# PDF LibrarySupport Team Member 4 related to The C# PDF LibrarySupport Team Member 2 related to The C# PDF Library
      Online 24/5
      Need help? Our sales team would be glad to help you.
      Try the Enterprise Trial
      ironpdf_for_dotnet_log2o
      Key in blue circle
      Get your free 30-day Trial Key instantly.
      bullet_checkedNo credit card or account creation required
      Key in blue circle
      Get your free 30-day Trial Key instantly.
      Blue key in circleNo credit card or account creation required
      Green Check in orange circle
      The trial form was submitted successfully.
      badge_greencheck_in_yellowcircle
      Thank you for starting a trial

      Please check your email for the trial license key.

      If you don’t receive an email, please start a live chat or email support@ironsoftware.com

      Install with NuGet
      View Licensing
      • Logo Aetna
      • Logo NASA
      • Logo GE
      • Logo Porsche
      • Logo USDA
      • Logo Qatar
      Join Millions of Engineers who’ve tried IronPDF