PdfForge 1.1.2
See the version list below for details.
dotnet add package PdfForge --version 1.1.2
NuGet\Install-Package PdfForge -Version 1.1.2
<PackageReference Include="PdfForge" Version="1.1.2" />
paket add PdfForge --version 1.1.2
#r "nuget: PdfForge, 1.1.2"
// Install PdfForge as a Cake Addin #addin nuget:?package=PdfForge&version=1.1.2 // Install PdfForge as a Cake Tool #tool nuget:?package=PdfForge&version=1.1.2
PdfForge
PdfForge is a library for rendering PDF documents into PNG images. It supports both saving pages to files and converting pages into byte arrays, making it a flexible solution for applications that need to work with PDF files in raster format.
Features
- Open PDF documents from a file.
- Render PDF pages to PNG images.
- Save pages as PNG files.
- Get pages as byte arrays (PNG format).
- Supports scaling when rendering pages.
Installation
Install via NuGet by adding a reference to the PdfForge package:
dotnet add package PdfForge
Usage
Opening Document
To work with a PDF document, create an instance of the PdfForgeDocument
class and provide the file path:
using PdfForge;
var pdfDocument = new PdfForgeDocument("sample.pdf");
Console.WriteLine($"Total Pages: {pdfDocument.TotalPages}");
Saving a Page as a PNG File
You can save a specific PDF page as a PNG file by specifying the page number and output file path:
pdfDocument.SavePageToPngFile(1, "page1.png");
Getting a Page as a Byte Array
You can also retrieve a PDF page as a byte array (in PNG format), useful for handling images in memory:
byte[] pageBytes = pdfDocument.GetPageBytes(1);
Releasing Resources
It's important to release resources when the document is no longer needed. You can call Dispose
manually or use using
to automatically release resources:
pdfDocument.Dispose();
Or with using
:
using var pdfDocument = new PdfForgeDocument("sample.pdf");
Requirements
- .NET 8.0 or later.
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. |
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PdfForge:
Package | Downloads |
---|---|
PdfForge.Avalonia
This library provides a custom control for Avalonia UI to render and display PDF documents using the PdfForge library. It supports rendering PDF pages as images and allows scaling for flexible display. PdfForge.Avalonia is ideal for Avalonia-based applications that require direct PDF visualization or manipulation through PdfForge, offering efficient rasterization into memory or files. |
GitHub repositories
This package is not used by any popular GitHub repositories.