PdfForge.Avalonia 1.1.4

dotnet add package PdfForge.Avalonia --version 1.1.4                
NuGet\Install-Package PdfForge.Avalonia -Version 1.1.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PdfForge.Avalonia" Version="1.1.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PdfForge.Avalonia --version 1.1.4                
#r "nuget: PdfForge.Avalonia, 1.1.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PdfForge.Avalonia as a Cake Addin
#addin nuget:?package=PdfForge.Avalonia&version=1.1.4

// Install PdfForge.Avalonia as a Cake Tool
#tool nuget:?package=PdfForge.Avalonia&version=1.1.4                

PdfForge.Avalonia

NuGet

PdfForge.Avalonia is a library that provides a custom PdfView control for rendering and displaying PDF documents in Avalonia UI applications. The control is built on top of the PdfForge library, offering smooth PDF rendering and easy integration into Avalonia applications.

Features

  • Display PDF documents inside Avalonia applications.
  • Render specific pages with customizable scale.
  • Panning support for easy navigation within the document.
  • Show loading indicators during rendering.
  • Expose document dimensions for flexible UI layouts.

Installation

Install the PdfForge.Avalonia package via NuGet:

dotnet add package PdfForge.Avalonia

You also need to add styles in your app:

<Application.Styles>
    <FluentTheme />
    <StyleInclude Source="avares://PdfForge.Avalonia/Styles.axaml"/>
</Application.Styles>

Usage

XAML Example

You can use the PdfView control directly in your XAML to display PDF content. Bind the Document, PageNumber, and Scale properties to control the document and rendering behavior:

<Window
xmlns:avalonia="clr-namespace:PdfForge.Avalonia;assembly=PdfForge.Avalonia">

<avalonia:PdfView Document="{Binding PdfDocument}"
                  PageNumber="{Binding PageNumber}"
                  Scale="{Binding Scale}" />
</Window>

Code-Behind Example

You can control the PdfView via code by setting properties like Document, PageNumber, and Scale:

var pdfView = new PdfView
{
    Document = new PdfForgeDocument("sample.pdf"),
    PageNumber = 0,
    Scale = 1.0
};

Basic Example (XAML with Button Controls)

Here’s an example that demonstrates how to integrate PdfView with buttons for page navigation and zoom:

<Grid>
    <avalonia:PdfView x:Name="PdfViewer"
                      Document="{Binding PdfDocument}"
                      PageNumber="{Binding PageNumber}"
                      Scale="{Binding Scale}" />
    
    <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
        <Button Content="Previous Page" Command="{Binding PrevPageCommand}" />
        <Button Content="Next Page" Command="{Binding NextPageCommand}" />
        <Button Content="Zoom In" Command="{Binding ZoomInCommand}" />
        <Button Content="Zoom Out" Command="{Binding ZoomOutCommand}" />
    </StackPanel>
</Grid>

Control Properties

  • Document: The PdfForgeDocument instance to render.
  • PageNumber: The current page number to display.
  • Scale: The scaling factor for the PDF page rendering.

Requirements

  • .NET 8.0+
  • Avalonia UI for building the user interface (11.1.4+).
  • PdfForge library for PDF rendering.

License

This project is licensed under the GPL-3.0 license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.4 77 10/24/2024
1.1.3 73 10/24/2024
1.1.2 78 10/24/2024
1.1.1 78 10/24/2024

Initial release of PdfForge.Avalonia.