Harara.Pdf
1.0.1
dotnet add package Harara.Pdf --version 1.0.1
NuGet\Install-Package Harara.Pdf -Version 1.0.1
<PackageReference Include="Harara.Pdf" Version="1.0.1" />
<PackageVersion Include="Harara.Pdf" Version="1.0.1" />
<PackageReference Include="Harara.Pdf" />
paket add Harara.Pdf --version 1.0.1
#r "nuget: Harara.Pdf, 1.0.1"
#:package Harara.Pdf@1.0.1
#addin nuget:?package=Harara.Pdf&version=1.0.1
#tool nuget:?package=Harara.Pdf&version=1.0.1
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.ImageSharpHarara.Pdf.NetVipsHarara.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 | 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. 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. |
-
net8.0
- Harara.Bidi (>= 1.0.3)
- PathParsing.Net (>= 0.0.2)
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 |