ArrayToPdf 2.2.1

dotnet add package ArrayToPdf --version 2.2.1
NuGet\Install-Package ArrayToPdf -Version 2.2.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="ArrayToPdf" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArrayToPdf --version 2.2.1
#r "nuget: ArrayToPdf, 2.2.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.
// Install ArrayToPdf as a Cake Addin
#addin nuget:?package=ArrayToPdf&version=2.2.1

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

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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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.2.1 266 1/31/2024
2.1.0 140 1/8/2024
2.0.5 6,406 11/9/2022
2.0.4 9,737 11/13/2021
2.0.3 869 11/7/2021
2.0.2 313 11/7/2021
2.0.1 312 11/7/2021
2.0.0 498 11/6/2021
1.0.1 19,874 2/7/2020
1.0.0 537 2/7/2020