alexa
menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class PdfBitmapExtension

    Represents the PdfBitmapExtension class.

    Inheritance
    System.Object
    PdfBitmapExtension
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Imaging.NET.dll
    Syntax
    public static class PdfBitmapExtension : Object
    Remarks

    The extension converts the unsupported image formats such as BMP, GIF, ICO, and Webp to PNG using Skiasharp and returns the PdfBitmap object.

    Methods

    CreatePdfBitmap(Stream)

    Creates the PdfBitmap using image stream.

    Declaration
    public static PdfBitmap CreatePdfBitmap(Stream imageStream)
    Parameters
    Type Name Description
    System.IO.Stream imageStream
    Returns
    Type
    PdfBitmap
    Examples
    //Create a new PDF document.
    PdfDocument doc = new PdfDocument();
    //Add a page to the document.
    PdfPage page = doc.Pages.Add();
    //Create PDF graphics for the page
    PdfGraphics graphics = page.Graphics;
    FileStream imageStream = new FileStream("image4.jpg", FileMode.Open, FileAccess.Read);
    PdfBitmap bitmap = PdfBitmapExtension.CreatePdfBitmap(imageStream);
    graphics.DrawImage(bitmap, new RectangleF(0, 0, 500, 500));
    //Save the document.
    MemoryStream ms = new MemoryStream();
    doc.Save(ms);
    //Close the document.
    doc.Close(true);
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved