Harara.Pdf 1.0.1

dotnet add package Harara.Pdf --version 1.0.1
                    
NuGet\Install-Package Harara.Pdf -Version 1.0.1
                    
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="Harara.Pdf" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Harara.Pdf" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Harara.Pdf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Harara.Pdf --version 1.0.1
                    
#r "nuget: Harara.Pdf, 1.0.1"
                    
#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.
#:package Harara.Pdf@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Harara.Pdf&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Harara.Pdf&version=1.0.1
                    
Install as a Cake Tool

Harara.Pdf

A C# library for PDF generation — a faithful and idiomatic port of the popular Dart PDF library.
Designed for .NET developers who need to generate PDF documents programmatically with fine-grained control over layout, text, images, shapes, and more — using a powerful widget-based system similar to Flutter.


✨ Features

  • Create multi-page PDF documents
  • Powerful Widget system for flexible layout composition
  • Text styling, wrapping, alignment, and rich layout
  • Draw shapes, images, lines, Tables, Charts and more
  • Shadow generation and styling
  • Supports RTL languges

📦 Installation

dotnet add package Harara.Pdf

🛠️ Usage

using Harara.Pdf.ImageSharp;
using Harara.Pdf.Pdf;
using Harara.Pdf.Widgets;

PdfOptions.SetImageDecoder(new ImageSharpDecoder());
var pdf = new Document();
pdf.AddPage(new Page(
    build: context =>
        new Center(
            child: new Column(
                children: [
                    new Text("Welcome", style: new TextStyle(fontSize:30)),
                    new Text("Thank you for using Harara.Pdf")
                ]
            )
        )
));
var bytes = await pdf.SaveAsync();
File.WriteAllBytes("output.pdf", bytes);

🧩 Custom Widgets with StatelessWidget

You can extend the PDF widget system by creating your own widgets using StatelessWidget:

using Harara.Pdf.ImageSharp;
using Harara.Pdf.Pdf;
using Harara.Pdf.Widgets;

PdfOptions.SetImageDecoder(new ImageSharpDecoder());
var pdf = new Document();
pdf.AddPage(new Page(
    build: context => new Custom()
));
var bytes = await pdf.SaveAsync();
File.WriteAllBytes("output.pdf", bytes);

class Custom : StatelessWidget
{
    public override Widget Build(Context context)
    {
        return new Center(
            child: new Column(
                children:
                [
                    new Text("Welcome", style: new TextStyle(fontSize: 30)),
                    new Text("Thank you for using Harara.Pdf")
                ]
            )
        );
    }
}


This allows you to encapsulate and reuse PDF widget logic just like you would in a Flutter or Dart `pdf` project.

⚠️ Image Decoder Required

You must include one of the following image decoder packages to enable image support:

  • Harara.Pdf.ImageSharp
  • Harara.Pdf.NetVips
  • Harara.Pdf.SkiaSharp

Alternatively, you can create your own custom image decoder by implementing the required IImageDecoder interface and registering it with the library.


📋 License

MIT License © Ahmed Harara
This project is inspired by the Dart pdf package.


🙋‍♂️ Contributions

Pull requests, issues, and ideas are always welcome.
Please open an issue to discuss major changes before submitting a PR.


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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Harara.Pdf:

Package Downloads
Harara.Pdf.ImageSharp

A helper library for Harara.Pdf that leverages ImageSharp to decode images, resize them, and generate soft shadows. Designed to streamline image preparation for embedding into PDFs, especially thumbnails and decorative assets.

Harara.Pdf.NetVips

A helper library for Harara.Pdf that leverages NetVips to decode images, resize them, and generate soft shadows. Designed to streamline image preparation for embedding into PDFs, especially thumbnails and decorative assets.

Harara.Pdf.SkiaSharp

A helper library for Harara.Pdf that leverages SkiaSharp to decode images, resize them, and generate soft shadows. Designed to streamline image preparation for embedding into PDFs, especially thumbnails and decorative assets.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 189 7/29/2025