### Install PDFtoImage Unity Package Source: https://github.com/sungaila/pdftoimage/blob/master/README.md Instructions for installing the PDFtoImage package in a Unity project using a Git URL in the Package Manager. ```bash https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage ``` -------------------------------- ### Get All Page Sizes Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt Retrieves the sizes of all pages in a PDF document. Supports input via byte array, Base64 string, or stream. ```APIDOC ## Get All Page Sizes ### Description Retrieves the sizes of all pages in a PDF document. ### Methods - `static IList GetPageSizes(byte[] pdfAsByteArray, string? password = null)` - `static IList GetPageSizes(string pdfAsBase64String, string? password = null)` - `static IList GetPageSizes(Stream pdfStream, bool leaveOpen = false, string? password = null)` ### Parameters - `pdfAsByteArray` (byte[]) - Required - The PDF document as a byte array. - `pdfAsBase64String` (string) - Required - The PDF document as a Base64 encoded string. - `pdfStream` (Stream) - Required - The PDF document as a stream. - `password` (string?) - Optional - The password for encrypted PDF documents. - `leaveOpen` (bool) - Optional - If true, the stream will not be closed after the operation. Defaults to false. ### Returns - `IList` - A list containing the sizes of all pages in the PDF document. ``` -------------------------------- ### Include Raw Assets in .NET MAUI Project Source: https://github.com/sungaila/pdftoimage/blob/master/src/FrameworkTests/MauiApp/Resources/Raw/AboutAssets.txt This snippet shows how to configure the `.csproj` file to include all raw assets from the Resources\Raw directory and its subdirectories. The `LogicalName` ensures the asset is accessible with its original path. ```xml ``` -------------------------------- ### Accessing Raw Assets at Runtime Source: https://github.com/sungaila/pdftoimage/blob/master/src/FrameworkTests/MauiApp/Resources/Raw/AboutAssets.txt This C# code demonstrates how to load and read the contents of a raw asset file deployed with your application. Ensure the asset is included using the `MauiAsset` build action. ```csharp async Task LoadMauiAsset() { using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); using var reader = new StreamReader(stream); var contents = reader.ReadToEnd(); } ``` -------------------------------- ### PDFtoImage.RenderOptions Constructor Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net9.0-browser/PublicAPI.Shipped.txt Provides details on the constructor for the RenderOptions class, which allows for customization of PDF rendering. It supports setting DPI, dimensions, annotations, form filling, aspect ratio, rotation, anti-aliasing, background color, bounds, tiling, and grayscale. ```APIDOC ## PDFtoImage.RenderOptions Constructor ### Description Initializes a new instance of the `RenderOptions` class with specified rendering parameters. ### Method `PDFtoImage.RenderOptions.RenderOptions( int Dpi = 300, int? Width = null, int? Height = null, bool WithAnnotations = false, bool WithFormFill = false, bool WithAspectRatio = false, PDFtoImage.PdfRotation Rotation = PDFtoImage.PdfRotation.Rotate0, PDFtoImage.PdfAntiAliasing AntiAliasing = PDFtoImage.PdfAntiAliasing.All, SkiaSharp.SKColor? BackgroundColor = null, System.Drawing.RectangleF? Bounds = null, bool UseTiling = false, bool DpiRelativeToBounds = false, bool Grayscale = false ) ### Parameters #### Optional Parameters - **Dpi** (int) - Default: 300 - Dots per inch for rendering. - **Width** (int?) - Default: null - The desired width of the output image. - **Height** (int?) - Default: null - The desired height of the output image. - **WithAnnotations** (bool) - Default: false - Whether to include annotations in the rendered image. - **WithFormFill** (bool) - Default: false - Whether to include form fill data in the rendered image. - **WithAspectRatio** (bool) - Default: false - Whether to maintain the aspect ratio of the PDF content. - **Rotation** (PDFtoImage.PdfRotation) - Default: PDFtoImage.PdfRotation.Rotate0 - The rotation to apply to the rendered image. - **AntiAliasing** (PDFtoImage.PdfAntiAliasing) - Default: PDFtoImage.PdfAntiAliasing.All - The anti-aliasing mode to use for rendering. - **BackgroundColor** (SkiaSharp.SKColor?) - Default: null - The background color of the rendered image. - **Bounds** (System.Drawing.RectangleF?) - Default: null - The specific bounds within the PDF page to render. - **UseTiling** (bool) - Default: false - Whether to use tiling for rendering large pages. - **DpiRelativeToBounds** (bool) - Default: false - Whether DPI is relative to the specified bounds. - **Grayscale** (bool) - Default: false - Whether to render the image in grayscale. ``` -------------------------------- ### PDFtoImage.RenderOptions Constructor Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net471/PublicAPI.Shipped.txt Provides details on the constructor for the RenderOptions class, which allows for detailed configuration of PDF rendering. ```APIDOC ## PDFtoImage.RenderOptions() ### Description Initializes a new instance of the `RenderOptions` class with default settings. ### Method Constructor ### Parameters None ### Response Initializes the `RenderOptions` object. ``` ```APIDOC ## PDFtoImage.RenderOptions( int Dpi = 300, int? Width = null, int? Height = null, bool WithAnnotations = false, bool WithFormFill = false, bool WithAspectRatio = false, PDFtoImage.PdfRotation Rotation = PDFtoImage.PdfRotation.Rotate0, PDFtoImage.PdfAntiAliasing AntiAliasing = PDFtoImage.PdfAntiAliasing.All, SkiaSharp.SKColor? BackgroundColor = null, System.Drawing.RectangleF? Bounds = null, bool UseTiling = false, bool DpiRelativeToBounds = false, bool Grayscale = false ) ### Description Initializes a new instance of the `RenderOptions` class with specified rendering parameters. ### Method Constructor ### Parameters * **Dpi** (int) - Optional - Dots per inch for rendering. Defaults to 300. * **Width** (int?) - Optional - The desired width of the output image in pixels. * **Height** (int?) - Optional - The desired height of the output image in pixels. * **WithAnnotations** (bool) - Optional - Whether to include annotations in the rendered image. Defaults to false. * **WithFormFill** (bool) - Optional - Whether to include form fill data in the rendered image. Defaults to false. * **WithAspectRatio** (bool) - Optional - Whether to maintain the aspect ratio of the PDF content. Defaults to false. * **Rotation** (PDFtoImage.PdfRotation) - Optional - The rotation to apply to the rendered image. Defaults to `PDFtoImage.PdfRotation.Rotate0`. * **AntiAliasing** (PDFtoImage.PdfAntiAliasing) - Optional - The anti-aliasing mode to use for rendering. Defaults to `PDFtoImage.PdfAntiAliasing.All`. * **BackgroundColor** (SkiaSharp.SKColor?) - Optional - The background color for transparent areas. Defaults to null. * **Bounds** (System.Drawing.RectangleF?) - Optional - A rectangle defining the area of the PDF to render. Defaults to null. * **UseTiling** (bool) - Optional - Whether to use tiling for rendering large pages. Defaults to false. * **DpiRelativeToBounds** (bool) - Optional - Whether DPI is relative to the bounds. Defaults to false. * **Grayscale** (bool) - Optional - Whether to render the image in grayscale. Defaults to false. ### Response Initializes the `RenderOptions` object with the provided configuration. ``` -------------------------------- ### Using Open Iconic with Foundation Classes Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Apply icons in Foundation projects using the `fi-icon-name` classes. The `title` attribute provides a tooltip, and `aria-hidden` improves accessibility. ```html ``` -------------------------------- ### RenderOptions Class Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/netstandard2.1/PublicAPI.Shipped.txt A concrete implementation of IRenderOptions, providing default values and constructors for configuring PDF to image conversion settings. ```APIDOC ## Class: RenderOptions ### Description Provides a concrete implementation of rendering options for PDF to image conversion. It allows for detailed configuration of the output image, including dimensions, quality, and visual enhancements. ### Constructors #### RenderOptions() Initializes a new instance of the `RenderOptions` class with default settings. #### RenderOptions(int Dpi = 300, int? Width = null, int? Height = null, bool WithAnnotations = false, bool WithFormFill = false, bool WithAspectRatio = false, PDFtoImage.PdfRotation Rotation = PDFtoImage.PdfRotation.Rotate0, PDFtoImage.PdfAntiAliasing AntiAliasing = PDFtoImage.PdfAntiAliasing.All, SkiaSharp.SKColor? BackgroundColor = null, System.Drawing.RectangleF? Bounds = null, bool UseTiling = false, bool DpiRelativeToBounds = false, bool Grayscale = false) Initializes a new instance of the `RenderOptions` class with specified rendering parameters. ### Properties - **AntiAliasing** (PDFtoImage.PdfAntiAliasing) - Gets or initializes the anti-aliasing mode. - **BackgroundColor** (SkiaSharp.SKColor?) - Gets or initializes the background color of the rendered image. - **Bounds** (System.Drawing.RectangleF?) - Gets or initializes the specific bounds within the PDF page to render. - **Dpi** (int) - Gets or initializes the dots per inch (DPI) for the rendered image. - **DpiRelativeToBounds** (bool) - Gets or initializes a value indicating whether DPI is relative to the bounds. - **Height** (int?) - Gets or initializes the desired height of the rendered image. - **Rotation** (PDFtoImage.PdfRotation) - Gets or initializes the rotation to apply to the rendered image. - **UseTiling** (bool) - Gets or initializes a value indicating whether tiling should be used. - **Width** (int?) - Gets or initializes the desired width of the rendered image. - **WithAnnotations** (bool) - Gets or initializes a value indicating whether to include annotations. - **WithAspectRatio** (bool) - Gets or initializes a value indicating whether to maintain the aspect ratio. - **WithFormFill** (bool) - Gets or initializes a value indicating whether to include form fill data. - **Grayscale** (bool) - Gets or initializes a value indicating whether to render in grayscale. ``` -------------------------------- ### Theme Toggling based on System Preference Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/index.html Sets the initial theme (light or dark) based on the user's system preference and provides a function to toggle the theme manually. It updates the 'data-bs-theme' attribute on the root element. ```javascript globalThis.matchMedia('(prefers-color-scheme: dark)').onchange = event => { if (event.matches) { document.documentElement.dataset.bsTheme = 'dark'; } else { document.documentElement.dataset.bsTheme = 'light'; } }; if (globalThis.matchMedia('(prefers-color-scheme: dark)').matches) { document.documentElement.dataset.bsTheme = 'dark'; } else { document.documentElement.dataset.bsTheme = 'light'; } document.body.classList.remove('body-dummy'); ``` ```javascript globalThis.toggleTheme = () => { if (document.documentElement.dataset.bsTheme == 'dark') { document.documentElement.dataset.bsTheme = 'light'; } else { document.documentElement.dataset.bsTheme = 'dark'; } } ``` -------------------------------- ### Using Open Iconic Standalone Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Apply icons in standalone projects using the `oi` class and the `data-glyph` attribute to specify the icon name. The `title` attribute provides a tooltip, and `aria-hidden` improves accessibility. ```html ``` -------------------------------- ### Download File from Stream Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/index.html Initiates a file download in the browser by converting a stream reference into a Blob and then creating a temporary URL for the Blob. It automatically triggers the download and cleans up the URL. ```javascript globalThis.downloadFileFromStream = async (fileName, imageMime, contentStreamReference) => { const arrayBuffer = await contentStreamReference.arrayBuffer(); const blob = new Blob([arrayBuffer], { type: imageMime }); const url = URL.createObjectURL(blob); const anchorElement = document.createElement('a'); anchorElement.href = url; anchorElement.download = fileName ?? ''; anchorElement.click(); anchorElement.remove(); URL.revokeObjectURL(url); } ``` -------------------------------- ### Including Open Iconic with Foundation Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Link to the Foundation-specific stylesheet for Open Iconic. This allows the use of Foundation's icon classes. ```html ``` -------------------------------- ### Including Open Iconic Standalone Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Link to the default Open Iconic stylesheet for standalone usage. This enables the use of the `oi` and `data-glyph` attributes. ```html ``` -------------------------------- ### ToImages Overloads Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net471/PublicAPI.Shipped.txt Converts all pages or a specified range of pages from a PDF source (byte array, base64 string, or stream) into an enumerable collection of SKBitmap objects. Supports optional password protection and rendering options. ```APIDOC ## ToImages ### Description Converts all pages or a specified range of pages from a PDF source (byte array, base64 string, or stream) into an enumerable collection of SKBitmap objects. Supports optional password protection and rendering options. ### Method Not Applicable (SDK Method) ### Endpoint Not Applicable (SDK Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Overloads: 1. **ToImages(byte[] pdfAsByteArray, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsByteArray** (byte[]!) - Required - The PDF data as a byte array. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 2. **ToImages(byte[] pdfAsByteArray, System.Collections.Generic.IEnumerable pages, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsByteArray** (byte[]!) - Required - The PDF data as a byte array. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 3. **ToImages(byte[] pdfAsByteArray, System.Range pages, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsByteArray** (byte[]!) - Required - The PDF data as a byte array. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 4. **ToImages(string pdfAsBase64String, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsBase64String** (string!) - Required - The PDF data as a Base64 encoded string. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 5. **ToImages(string pdfAsBase64String, System.Collections.Generic.IEnumerable pages, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsBase64String** (string!) - Required - The PDF data as a Base64 encoded string. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 6. **ToImages(string pdfAsBase64String, System.Range pages, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfAsBase64String** (string!) - Required - The PDF data as a Base64 encoded string. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 7. **ToImages(System.IO.Stream pdfStream, bool leaveOpen = false, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF data. - **leaveOpen** (bool) - Optional - Whether to leave the PDF stream open after conversion. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 8. **ToImages(System.IO.Stream pdfStream, System.Collections.Generic.IEnumerable pages, bool leaveOpen = false, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF data. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **leaveOpen** (bool) - Optional - Whether to leave the PDF stream open after conversion. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 9. **ToImages(System.IO.Stream pdfStream, System.Range pages, bool leaveOpen = false, string? password = null, PDFtoImage.RenderOptions options = default)** -> System.Collections.Generic.IEnumerable! - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF data. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **leaveOpen** (bool) - Optional - Whether to leave the PDF stream open after conversion. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. ### Response #### Success Response - **IEnumerable** - An enumerable collection of SKBitmap objects representing the converted PDF pages. #### Response Example None (return type is an enumerable collection) ``` -------------------------------- ### Using Open Iconic with Bootstrap Classes Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Apply icons in Bootstrap projects using the `oi` and `oi-icon-name` classes. The `title` attribute provides a tooltip, and `aria-hidden` improves accessibility. ```html ``` -------------------------------- ### ToImages (stream, all pages) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0-android/PublicAPI.Shipped.txt Converts all pages of a PDF document, provided as a stream, into a collection of SKBitmap objects. ```APIDOC ## ToImages (stream, all pages) ### Description Converts all pages of a PDF document, provided as a stream, into an enumerable collection of SKBitmap objects. Allows control over whether the input stream is left open after the operation. Supports password protection and custom rendering options. ### Method `PDFtoImage.Conversion.ToImages` ### Parameters * `pdfStream` (System.IO.Stream!) - The stream containing the PDF document. * `leaveOpen` (bool) - Optional. If true, the input stream is left open after the operation (defaults to false). * `password` (string?) - Optional. The password for encrypted PDF documents. * `options` (PDFtoImage.RenderOptions) - Optional. Rendering options for the conversion. ### Returns `System.Collections.Generic.IEnumerable!` - An enumerable collection of SKBitmap objects, each representing a page of the PDF. ``` -------------------------------- ### ToImages (overloads) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net8.0-browser/PublicAPI.Shipped.txt Converts all pages or a specified range of pages from a PDF document into a collection of SkiaSharp SKBitmap objects. Overloaded to accept PDF input as a byte array, base64 string, or stream. Supports optional password protection and custom render options. The `leaveOpen` parameter controls whether the input stream remains open when using a PDF stream. ```APIDOC ## ToImages ### Description Converts all pages or a specified range of pages from a PDF document into a collection of SkiaSharp SKBitmap objects. Overloaded to accept PDF input as a byte array, base64 string, or stream. Supports optional password protection and custom render options. The `leaveOpen` parameter controls whether the input stream remains open when using a PDF stream. ### Method static PDFtoImage.Conversion.ToImages ### Parameters #### Overload 1: Byte Array (All Pages) - **pdfAsByteArray** (byte[]!) - Required - The PDF document as a byte array. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 2: Byte Array (Specific Pages by Integer List) - **pdfAsByteArray** (byte[]!) - Required - The PDF document as a byte array. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 3: Byte Array (Specific Pages by Range) - **pdfAsByteArray** (byte[]!) - Required - The PDF document as a byte array. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 4: Base64 String (All Pages) - **pdfAsBase64String** (string!) - Required - The PDF document as a Base64 encoded string. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 5: Base64 String (Specific Pages by Integer List) - **pdfAsBase64String** (string!) - Required - The PDF document as a Base64 encoded string. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 6: Base64 String (Specific Pages by Range) - **pdfAsBase64String** (string!) - Required - The PDF document as a Base64 encoded string. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 7: Stream (All Pages) - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF document. - **leaveOpen** (bool) - Optional - If true, the `pdfStream` will remain open after the operation (defaults to false). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 8: Stream (Specific Pages by Integer List) - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF document. - **pages** (System.Collections.Generic.IEnumerable!) - Required - An enumerable collection of page numbers to convert. - **leaveOpen** (bool) - Optional - If true, the `pdfStream` will remain open after the operation (defaults to false). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 9: Stream (Specific Pages by Range) - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF document. - **pages** (System.Range) - Required - A range specifying the pages to convert. - **leaveOpen** (bool) - Optional - If true, the `pdfStream` will remain open after the operation (defaults to false). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. ### Returns - **System.Collections.Generic.IEnumerable** - An enumerable collection of converted image bitmaps. ``` -------------------------------- ### PDFtoImage.RenderOptions Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0-maccatalyst/PublicAPI.Shipped.txt Provides configuration options for rendering PDF pages to images. Allows customization of DPI, dimensions, annotations, and more. ```APIDOC ## Class PDFtoImage.RenderOptions ### Description Provides configuration options for rendering PDF pages to images. Allows customization of DPI, dimensions, annotations, and more. ### Constructors - **RenderOptions()**: Initializes a new instance of the `RenderOptions` class with default settings. - **RenderOptions(int Dpi = 300, int? Width = null, int? Height = null, bool WithAnnotations = false, bool WithFormFill = false, bool WithAspectRatio = false, PDFtoImage.PdfRotation Rotation = PDFtoImage.PdfRotation.Rotate0, PDFtoImage.PdfAntiAliasing AntiAliasing = PDFtoImage.PdfAntiAliasing.All, SkiaSharp.SKColor? BackgroundColor = null, System.Drawing.RectangleF? Bounds = null, bool UseTiling = false, bool DpiRelativeToBounds = false, bool Grayscale = false)**: Initializes a new instance of the `RenderOptions` class with specified rendering parameters. ### Properties - **AntiAliasing** (PDFtoImage.PdfAntiAliasing): Gets or sets the anti-aliasing mode for rendering. - **BackgroundColor** (SkiaSharp.SKColor?): Gets or sets the background color for the rendered image. - **Bounds** (System.Drawing.RectangleF?): Gets or sets the specific bounds of the page to render. - **Dpi** (int): Gets or sets the dots per inch (DPI) for the rendering. - **DpiRelativeToBounds** (bool): Gets or sets a value indicating whether DPI is relative to the bounds. - **Grayscale** (bool): Gets or sets a value indicating whether to render in grayscale. - **Height** (int?): Gets or sets the desired height of the rendered image. - **Rotation** (PDFtoImage.PdfRotation): Gets or sets the rotation to apply to the rendered page. - **UseTiling** (bool): Gets or sets a value indicating whether to use tiling for rendering. - **Width** (int?): Gets or sets the desired width of the rendered image. - **WithAnnotations** (bool): Gets or sets a value indicating whether to include annotations in the rendering. - **WithAspectRatio** (bool): Gets or sets a value indicating whether to maintain the aspect ratio during rendering. - **WithFormFill** (bool): Gets or sets a value indicating whether to include form fill data in the rendering. ``` -------------------------------- ### ToImage Overloads Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net471/PublicAPI.Shipped.txt Converts a specific page from a PDF source (byte array, base64 string, or stream) into an SKBitmap object. Supports optional password protection and rendering options. ```APIDOC ## ToImage ### Description Converts a specific page from a PDF source (byte array, base64 string, or stream) into an SKBitmap object. Supports optional password protection and rendering options. ### Method Not Applicable (SDK Method) ### Endpoint Not Applicable (SDK Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Overloads: 1. **ToImage(byte[] pdfAsByteArray, System.Index page = default, string? password = null, PDFtoImage.RenderOptions options = default)** -> SkiaSharp.SKBitmap! - **pdfAsByteArray** (byte[]!) - Required - The PDF data as a byte array. - **page** (System.Index) - Optional - The specific page to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 2. **ToImage(string pdfAsBase64String, System.Index page = default, string? password = null, PDFtoImage.RenderOptions options = default)** -> SkiaSharp.SKBitmap! - **pdfAsBase64String** (string!) - Required - The PDF data as a Base64 encoded string. - **page** (System.Index) - Optional - The specific page to convert. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. 3. **ToImage(System.IO.Stream pdfStream, System.Index page = default, bool leaveOpen = false, string? password = null, PDFtoImage.RenderOptions options = default)** -> SkiaSharp.SKBitmap! - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF data. - **page** (System.Index) - Optional - The specific page to convert. - **leaveOpen** (bool) - Optional - Whether to leave the PDF stream open after conversion. - **password** (string?) - Optional - The password for encrypted PDF files. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options. ### Response #### Success Response - **SKBitmap!** - The converted PDF page as an SKBitmap object. #### Response Example None (return type is an object) ``` -------------------------------- ### Including Open Iconic with Bootstrap Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/css/open-iconic/README.md Link to the Bootstrap-specific stylesheet for Open Iconic. This enables the use of Bootstrap's icon classes. ```html ``` -------------------------------- ### ToImage (overloads) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net8.0-browser/PublicAPI.Shipped.txt Converts a specific page of a PDF document into a SkiaSharp SKBitmap object. Overloaded to accept PDF input as a byte array, base64 string, or stream. Supports optional password protection and custom render options. The `leaveOpen` parameter controls whether the input stream remains open when using a PDF stream. ```APIDOC ## ToImage ### Description Converts a specific page of a PDF document into a SkiaSharp SKBitmap object. Overloaded to accept PDF input as a byte array, base64 string, or stream. Supports optional password protection and custom render options. The `leaveOpen` parameter controls whether the input stream remains open when using a PDF stream. ### Method static PDFtoImage.Conversion.ToImage ### Parameters #### Overload 1: Byte Array - **pdfAsByteArray** (byte[]!) - Required - The PDF document as a byte array. - **page** (System.Index) - Optional - The specific page to convert (defaults to the first page). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 2: Base64 String - **pdfAsBase64String** (string!) - Required - The PDF document as a Base64 encoded string. - **page** (System.Index) - Optional - The specific page to convert (defaults to the first page). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. #### Overload 3: Stream - **pdfStream** (System.IO.Stream!) - Required - The stream containing the PDF document. - **page** (System.Index) - Optional - The specific page to convert (defaults to the first page). - **leaveOpen** (bool) - Optional - If true, the `pdfStream` will remain open after the operation (defaults to false). - **password** (string?) - Optional - The password for encrypted PDF documents. - **options** (PDFtoImage.RenderOptions) - Optional - Rendering options for the conversion. ### Returns - **SkiaSharp.SKBitmap!** - The converted image bitmap. ``` -------------------------------- ### ToImages (base64 string, all pages) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0-android/PublicAPI.Shipped.txt Converts all pages of a PDF document, provided as a base64 encoded string, into a collection of SKBitmap objects. ```APIDOC ## ToImages (base64 string, all pages) ### Description Converts all pages of a PDF document, provided as a base64 encoded string, into an enumerable collection of SKBitmap objects. Supports password protection and custom rendering options. ### Method `PDFtoImage.Conversion.ToImages` ### Parameters * `pdfAsBase64String` (string!) - A base64 encoded string representing the PDF document data. * `password` (string?) - Optional. The password for encrypted PDF documents. * `options` (PDFtoImage.RenderOptions) - Optional. Rendering options for the conversion. ### Returns `System.Collections.Generic.IEnumerable!` - An enumerable collection of SKBitmap objects, each representing a page of the PDF. ``` -------------------------------- ### ToImages (stream, specific pages by int list) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0-android/PublicAPI.Shipped.txt Converts specific pages of a PDF document, provided as a stream and a list of page numbers, into a collection of SKBitmap objects. ```APIDOC ## ToImages (stream, specific pages by int list) ### Description Converts specific pages of a PDF document, provided as a stream and an enumerable list of page numbers, into a collection of SKBitmap objects. Allows control over whether the input stream is left open after the operation. Supports password protection and custom rendering options. ### Method `PDFtoImage.Conversion.ToImages` ### Parameters * `pdfStream` (System.IO.Stream!) - The stream containing the PDF document. * `pages` (System.Collections.Generic.IEnumerable!) - An enumerable collection of integers specifying the page numbers to convert. * `leaveOpen` (bool) - Optional. If true, the input stream is left open after the operation (defaults to false). * `password` (string?) - Optional. The password for encrypted PDF documents. * `options` (PDFtoImage.RenderOptions) - Optional. Rendering options for the conversion. ### Returns `System.Collections.Generic.IEnumerable!` - An enumerable collection of SKBitmap objects, each representing a requested page of the PDF. ``` -------------------------------- ### Convert PDF to SKBitmap Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0/PublicAPI.Shipped.txt Converts a specified page of a PDF document into an SKBitmap object. Supports various input formats and optional parameters. ```APIDOC ## ToImage ### Description Converts a specified page from a PDF document into an `SKSharp.SKBitmap` object. This method supports PDF input via byte array, base64 string, or stream. Optional parameters include page selection, password protection, and rendering options. ### Method Signatures - `static SKBitmap ToImage(byte[] pdfAsByteArray, Index page = default(Index), string? password = null, RenderOptions options = default(RenderOptions))` - `static SKBitmap ToImage(string pdfAsBase64String, Index page = default(Index), string? password = null, RenderOptions options = default(RenderOptions))` - `static SKBitmap ToImage(Stream pdfStream, Index page = default(Index), bool leaveOpen = false, string? password = null, RenderOptions options = default(RenderOptions))` ### Parameters - `pdfAsByteArray` (byte[]!) - The PDF document as a byte array. - `pdfAsBase64String` (string!) - The PDF document as a base64 encoded string. - `pdfStream` (Stream!) - The stream containing the PDF document. - `page` (Index) - The specific page to convert (defaults to the first page). - `leaveOpen` (bool) - Whether to leave the `pdfStream` open after conversion (defaults to false). - `password` (string?) - The password for encrypted PDF files (optional). - `options` (RenderOptions) - Rendering options for the conversion (optional). ### Returns - `SKBitmap!` - An `SKSharp.SKBitmap` object representing the converted PDF page. ``` -------------------------------- ### Set Image Source from Stream Source: https://github.com/sungaila/pdftoimage/blob/master/src/WebConverter/wwwroot/index.html Loads an image into an HTML image element by converting a stream into a Blob and creating an object URL. It revokes the object URL once the image has loaded to free up memory. ```javascript globalThis.setImage = async (imageElementId, imageMime, imageStream) => { const arrayBuffer = await imageStream.arrayBuffer(); const blob = new Blob([arrayBuffer], { type: imageMime }); const url = URL.createObjectURL(blob); const image = document.getElementById(imageElementId); image.onload = () => { URL.revokeObjectURL(url); } image.src = url; } ``` -------------------------------- ### ToImages (byte array, all pages) Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net10.0-android/PublicAPI.Shipped.txt Converts all pages of a PDF document, provided as a byte array, into a collection of SKBitmap objects. ```APIDOC ## ToImages (byte array, all pages) ### Description Converts all pages of a PDF document, provided as a byte array, into an enumerable collection of SKBitmap objects. Supports password protection and custom rendering options. ### Method `PDFtoImage.Conversion.ToImages` ### Parameters * `pdfAsByteArray` (byte[]!) - A byte array containing the PDF document data. * `password` (string?) - Optional. The password for encrypted PDF documents. * `options` (PDFtoImage.RenderOptions) - Optional. Rendering options for the conversion. ### Returns `System.Collections.Generic.IEnumerable!` - An enumerable collection of SKBitmap objects, each representing a page of the PDF. ``` -------------------------------- ### PDFtoImage.IRenderOptions Properties Source: https://github.com/sungaila/pdftoimage/blob/master/src/PDFtoImage/PublicAPI/net8.0-browser/PublicAPI.Shipped.txt Exposes properties for configuring PDF rendering options, allowing fine-grained control over output. ```APIDOC ## PDFtoImage.IRenderOptions ### Description Interface defining the contract for PDF rendering options. ### Properties * **AntiAliasing** (PDFtoImage.PdfAntiAliasing) - Gets or initializes the anti-aliasing mode. * **BackgroundColor** (SkiaSharp.SKColor?) - Gets or initializes the background color. * **Bounds** (System.Drawing.RectangleF?) - Gets or initializes the rendering bounds. * **Dpi** (int) - Gets or initializes the dots per inch (DPI) for rendering. * **DpiRelativeToBounds** (bool) - Gets or initializes a value indicating whether DPI is relative to the bounds. * **Height** (int?) - Gets or initializes the desired height of the output image. * **Rotation** (PDFtoImage.PdfRotation) - Gets or initializes the rotation to apply. * **UseTiling** (bool) - Gets or initializes a value indicating whether tiling should be used. * **Width** (int?) - Gets or initializes the desired width of the output image. * **WithAnnotations** (bool) - Gets or initializes a value indicating whether annotations should be included. * **WithAspectRatio** (bool) - Gets or initializes a value indicating whether the aspect ratio should be maintained. * **WithFormFill** (bool) - Gets or initializes a value indicating whether form fillable fields should be included. * **Grayscale** (bool) - Gets or initializes a value indicating whether the image should be rendered in grayscale. ```