Search Results for

    Show / Hide Table of Contents

    Class ImageToPdfConverter

    The ImageToPdfConverter class can be used to create PDF documents from images. It accepts both image files and Bitmap objects as input.

    The ImageToPdf static methods create simple PDF documents containing each image as one page of the created PDF.

    To rasterize PDF documents as images (the reverse operation), see and

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

    Methods

    ImageToPdf(AnyBitmap, ImageBehavior, ChromePdfRenderOptions)

    Converts a single IronSoftware.Drawing.AnyBitmap object or Bitmap to a PDF document of matching dimensions. The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize. Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.

    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)

    Converts multiple IronSoftware.Drawing.AnyBitmap objects or Bitmaps into a PDF document. Each image creates 1 page which matches the image dimensions. The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize. Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.

    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)

    Converts multiple image files to a PDF document. Each image creates 1 page which matches the image dimensions. The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize. Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.

    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 an identical PDF document of matching dimensions. The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize. Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.

    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
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.