alexa
menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class PdfToImageConverter

    Represents the PDF to image converter.

    Inheritance
    System.Object
    PdfToImageConverter
    Implements
    System.IDisposable
    Namespace: Syncfusion.Maui.PdfToImageConverter
    Assembly: Syncfusion.Maui.PdfToImageConverter.dll
    Syntax
    public class PdfToImageConverter : Object, IDisposable

    Constructors

    PdfToImageConverter()

    Initialize the new instance of the PdfToImageConverter.

    Declaration
    public PdfToImageConverter()
    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter();
    //Load the PDF stream.
    imageConverter.Load(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    PdfToImageConverter(Stream)

    Initialize the new instance of the PdfToImageConverter.

    Declaration
    public PdfToImageConverter(Stream inputStream)
    Parameters
    Type Name Description
    System.IO.Stream inputStream

    The input PDF file stream to export as image.

    Examples
    //Initialize Pdf to Image converter with PDF stream.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    PdfToImageConverter(Stream, String)

    Initialize the new instance of the PDF to image converter.

    Declaration
    public PdfToImageConverter(Stream inputStream, string password)
    Parameters
    Type Name Description
    System.IO.Stream inputStream

    The input PDF file stream to export as image.

    System.String password

    The password (user or owner) of the encrypted document to open.

    Remarks

    Supports password-protected PDFs only on Android API level 35 and above.

    Examples
    //Initialize Pdf to Image converter with PDF stream.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream, password);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Properties

    PageCount

    Get the PDF document page count.

    Declaration
    public int PageCount { get; }
    Property Value
    Type
    System.Int32
    Examples
    //Initialize Pdf to Image converter with PDF stream.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream, password);
    //Get the page count
    int pageCount = imageConverter.PageCount;
    //Converts all the PDF pages to image stream.
    Stream[] imageStreamCollection = new Stream[pageCount];
    for (int i = 0; i != pageCount; i++)
        imageStreamCollection[i] = imageConverter.Convert(i);
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Methods

    Convert(Rect, Single)

    Convert the PDF pages to images.

    Declaration
    public Stream[] Convert(Rect bounds, float scaleFactor = 1F)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect bounds

    The cropping bounds of the PDF page.

    System.Single scaleFactor

    The scaling factor of the output images. Default value is 1.

    Returns
    Type Description
    System.IO.Stream[]

    Array of image stream.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert(new Rect(0, 0, 200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Convert(Size, Single)

    Convert the PDF pages to images.

    Declaration
    public Stream[] Convert(Size size, float scaleFactor = 1F)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Size size

    Output image size.

    System.Single scaleFactor

    The scaling factor of the output images. Default value is 1.

    Returns
    Type Description
    System.IO.Stream[]

    Array of image stream.

    Remarks

    The size unit is a pixel.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert(new Size(200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Convert(Int32, Rect, Single)

    Convert the PDF page to image.

    Declaration
    public Stream Convert(int pageIndex, Rect bounds, float scaleFactor = 1F)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    Microsoft.Maui.Graphics.Rect bounds

    The cropping bounds of the PDF page.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    Returns
    Type Description
    System.IO.Stream

    Image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = imageConverter.Convert(0, new Rect(0, 0, 200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Convert(Int32, Size, Single)

    Convert the PDF page to image.

    Declaration
    public Stream Convert(int pageIndex, Size size, float scaleFactor = 1F)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    Microsoft.Maui.Graphics.Size size

    Output image size.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    Returns
    Type Description
    System.IO.Stream

    Image stream

    Remarks

    The size unit is a pixel.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = imageConverter.Convert(0, new Size(200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Convert(Int32, Single)

    Convert the PDF page to image.

    Declaration
    public Stream Convert(int pageIndex, float scaleFactor = 1F)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    Returns
    Type Description
    System.IO.Stream

    Image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = imageConverter.Convert(0));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Convert(Single)

    Convert the PDF pages to images.

    Declaration
    public Stream[] Convert(float scaleFactor = 1F)
    Parameters
    Type Name Description
    System.Single scaleFactor

    The scaling factor of the output images. Default value is 1.

    Returns
    Type Description
    System.IO.Stream[]

    Array of image stream.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Rect, Single, CancellationToken)

    Convert the PDF pages to images.

    Declaration
    public Task<Stream[]> ConvertAsync(Rect bounds, float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect bounds

    The cropping bounds of the PDF page.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream[]>

    Array of image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = await imageConverter.ConvertAsync(new Rect(0, 0, 200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Size, Single, CancellationToken)

    Convert the PDF pages to images.

    Declaration
    public Task<Stream[]> ConvertAsync(Size size, float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Size size

    Output image size.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream[]>

    Array of image stream

    Remarks

    The size unit is a pixel.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = await imageConverter.ConvertAsync(new Size(200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Int32, Rect, Single, CancellationToken)

    Convert the PDF page to image.

    Declaration
    public Task<Stream> ConvertAsync(int pageIndex, Rect bounds, float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    Microsoft.Maui.Graphics.Rect bounds

    The cropping bounds of the PDF page.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream>

    Image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = await imageConverter.ConvertAsync(0, new Rect(0, 0, 200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Int32, Size, Single, CancellationToken)

    Convert the PDF page to image.

    Declaration
    public Task<Stream> ConvertAsync(int pageIndex, Size size, float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    Microsoft.Maui.Graphics.Size size

    Output image size.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream>

    Image stream

    Remarks

    The size unit is a pixel.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = await imageConverter.ConvertAsync(0, new Size(200, 200));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Int32, Single, CancellationToken)

    Convert the PDF page to image.

    Declaration
    public Task<Stream> ConvertAsync(int pageIndex, float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.Int32 pageIndex

    The PDF page index to convert as image.

    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream>

    Image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream imageStream = await imageConverter.ConvertAsync(0));
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    ConvertAsync(Single, CancellationToken)

    Convert the PDF pages to images.

    Declaration
    public Task<Stream[]> ConvertAsync(float scaleFactor = 1F, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.Single scaleFactor

    The scaling factor of the output image. Default value is 1.

    System.Threading.CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.IO.Stream[]>

    Array of image stream

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = await imageConverter.ConvertAsync();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Dispose()

    Dispose the PdfToImageConverter.

    Declaration
    public void Dispose()
    Examples
    //Initialize the PdfToImageConverter.
    PdfToImageConverter converter = new PdfToImageConverter(stream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = converter.Convert();
    //Dispose.
    converter.Dispose();

    Load(Stream)

    Load the input PDF file as stream.

    Declaration
    public void Load(Stream inputStream)
    Parameters
    Type Name Description
    System.IO.Stream inputStream

    The PDF file stream.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter();
    //Load the PDF stream.
    imageConverter.Load(inputStream);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Load(Stream, String)

    Load the protected PDF stream with password.

    Declaration
    public void Load(Stream inputStream, string password)
    Parameters
    Type Name Description
    System.IO.Stream inputStream

    The PDF file stream.

    System.String password

    The password (user or owner) of the encrypted document to open.

    Remarks

    Supports password-protected PDFs only on Android API level 35 and above.

    Examples
    //Initialize Pdf to Image converter instance.
    PdfToImageConverter imageConverter = new PdfToImageConverter();
    //Load the PDF stream with password.
    imageConverter.Load(inputStream, password);
    //Converts PDF to image stream.
    Stream[] imageStreamCollection = imageConverter.Convert();
    //Dispose PDF to image converter instance.
    imageConverter.Dispose();

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved