ArrayToPdf 2.0.5

.NET 6.0 .NET Standard 2.0 .NET Framework 4.5
dotnet add package ArrayToPdf --version 2.0.5
NuGet\Install-Package ArrayToPdf -Version 2.0.5
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="ArrayToPdf" Version="2.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArrayToPdf --version 2.0.5
#r "nuget: ArrayToPdf, 2.0.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArrayToPdf as a Cake Addin
#addin nuget:?package=ArrayToPdf&version=2.0.5

// Install ArrayToPdf as a Cake Tool
#tool nuget:?package=ArrayToPdf&version=2.0.5

ArrayToPdf

Create PDF from Array (List, DataTable, ...)

Example 1: Create with default settings

using ArrayToPdf;

var items = Enumerable.Range(1, 100).Select(x => new
{
    Prop1 = $"Text #{x}",
    Prop2 = x * 1000,
    Prop3 = DateTime.Now.AddDays(-x),
});

var pdf = items.ToPdf();

Result: example1.pdf

Example 2: Rename title and columns

var pdf = items.ToPdf(schema => schema
    .Title("Example name")
    .ColumnName(m => m.Name.Replace("Prop", "Column #")));

Result: example2.pdf

Example 3: Sort columns

var pdf = items.ToPdf(schema => schema
    .ColumnSort(m => m.Name, desc: true));

Result: example3.pdf

Example 4: Custom column's mapping

var pdf = items.ToPdf(schema => schema
    .PageOrientation(PdfOrientations.Portrait)
    .PageMarginLeft(15)
    .AddColumn("MyColumnName #1", x => x.Prop1, 30)
    .AddColumn("MyColumnName #2", x => $"test:{x.Prop2}")
    .AddColumn("MyColumnName #3", x => x.Prop3));

Result: example4.pdf

Example 5: Filter columns

var pdf = items.ToPdf(schema => schema
    .ColumnFilter(m => m.Name != "Prop2"));

Result: example5.pdf

Example 6: Create from DataTable

var table = new DataTable("Example Table");

table.Columns.Add("Column #1", typeof(string));
table.Columns.Add("Column #2", typeof(int));
table.Columns.Add("Column #3", typeof(DateTime));

for (var x = 1; x <= 100; x++)
    table.Rows.Add($"Text #{x}", x * 1000, DateTime.Now.AddDays(-x));

var pdf = table.ToPdf();

Result: example6.pdf

Example.ConsoleApp

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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
2.0.5 211 11/9/2022
2.0.4 5,637 11/13/2021
2.0.3 486 11/7/2021
2.0.2 205 11/7/2021
2.0.1 214 11/7/2021
2.0.0 392 11/6/2021
1.0.1 13,168 2/7/2020
1.0.0 408 2/7/2020