PdfForge.Avalonia
1.1.3
See the version list below for details.
dotnet add package PdfForge.Avalonia --version 1.1.3
NuGet\Install-Package PdfForge.Avalonia -Version 1.1.3
<PackageReference Include="PdfForge.Avalonia" Version="1.1.3" />
paket add PdfForge.Avalonia --version 1.1.3
#r "nuget: PdfForge.Avalonia, 1.1.3"
// Install PdfForge.Avalonia as a Cake Addin #addin nuget:?package=PdfForge.Avalonia&version=1.1.3 // Install PdfForge.Avalonia as a Cake Tool #tool nuget:?package=PdfForge.Avalonia&version=1.1.3
PdfForge.Avalonia
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 Apache v2.0 license.
Product | Versions 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of PdfForge.Avalonia.