PdfTemplating.XslFO.Xslt 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PdfTemplating.XslFO.Xslt --version 1.0.0
NuGet\Install-Package PdfTemplating.XslFO.Xslt -Version 1.0.0
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="PdfTemplating.XslFO.Xslt" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PdfTemplating.XslFO.Xslt --version 1.0.0
#r "nuget: PdfTemplating.XslFO.Xslt, 1.0.0"
#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 PdfTemplating.XslFO.Xslt as a Cake Addin
#addin nuget:?package=PdfTemplating.XslFO.Xslt&version=1.0.0

// Install PdfTemplating.XslFO.Xslt as a Cake Tool
#tool nuget:?package=PdfTemplating.XslFO.Xslt&version=1.0.0

PdfTemplating.XslFO

This is a C#.Net solution that provides the capability to easily generate Pdf files using a templated approach that provides great separation between presentation (the template) and data (the Model); as opposed to extremely complex code based approaches most libraries provide. It's based on the Xsl-FO standard and currently is dependent on an old but still very functional libray "Fonet" -- which is port of Apache FOP to C#.

In addition, this is a completely open-source and free solution to use (even commercially). Many of the complex (powerful maybe, but horribly difficult to develop and maintain) API libraries out there require licenses and are no longer possible solutions when simply due to steep licensing costs.

I hope this helps anyone looking to dynamically generate PDF files in C# or .Net with a templating approach that is far more maintainable than other code based generation/manipulation approaches . . .

Project Overview:

This project illustrates the capabilities of using templating based approaches to render Xsl-FO for dynamically generating PDF documents. This project illustrates the use and support of two of the most common/well-known templating engines for .Net web development -- Razor Templating & XSLT Templating.

The Razor & Xslt template based approaches to rendering PDF files gives you the benefits of separating the presentation from the Data model, allows different team members to work at the same time because the Template can be developed offline with sample Model data that can be easily loaded, and the code can be made very manageable with the use of Xslt include files, variables, etc. to divide your code into modular "DRY" components for re-use across multiple reports, etc.

In addition, the Razor & Xslt engines are extensible and can support virtually unlimited capabilities with C# based extension functions. For Razor templates the world of .Net is immediately available (e.g. Linq). And, for XSLT custom extension functions can be defined in the assembly or inlinein the Xslt, and this project has many custom extensions already included to augment the Xslt v1.0 engine that .Net provides.

Finally, this project also provides basic a Windows Client (WinForms) application that provides a UI that can be used for developing when using the Xslt templating engine.

NOTE: Currently the Razor Implementation requires Microsoft.AspNet.MVC and does not yet support .Net Core. I plan to extend this as soon as I have a real need to render Pdf file from a .Net Core web application; or a console app for that matter (useful info. [https://stackoverflow.com/questions/38247080/using-razor-outside-of-mvc-in-net-core](here on StackOverflow).)

Usage is as easy as:
Xslt (.Net Standard 2.0):
//Initialize the Model to use in the templating process...
MovieSearchResults movieSearchResults = GetMovieSearchResults();

//Initialize the appropriate Renderer based on the Model to use in the Template...
string xsltFullyQualifiedPath = HttpContext.Current.Server.MapPath("~/Reports.Xslt/MoviePdfReport/MoviesReport.xsl");

IPdfTemplatingRenderer<MovieSearchResponse> pdfTemplatingRenderer = new XsltPdfTemplatingRenderer<MovieSearchResponse>(
    new FileInfo(xsltFullyQualifiedPath)
);

//Execute the Pdf Renderer template for the specified Model to generate the Pdf Document...
byte[] pdfBytes = pdfTemplatingRenderer.RenderPdf(movieSearchResults);
Razor View (.Net Framework and requires Microsoft.AspNet.Mvc):
//Initialize the Model to use in the templating process...
MovieSearchResults movieSearchResults = GetMovieSearchResults();

//Initialize the appropriate Renderer based on the Model to use in the Template...
IPdfTemplatingRenderer<MovieSearchResponse> pdfTemplatingRenderer = new AspNetMvcRazorPdfTemplatingRenderer<MovieSearchResults>(
    "~/Reports.Razor/MoviePdfReport/MoviesReport.cshtml",
    ControllerContext
);

//Execute the Pdf Renderer template for the specified Model to generate the Pdf Document...
byte[] pdfBytes = pdfTemplatingRenderer.RenderPdf(movieSearchResults);
Caveats:

Unfortunately the FONET library that this currently uses doesn't support all features that Xsl-FO can provide, and it's not as up to date as the Apache FOP project that it ported over from. But, in my experience it's still very capable and has worked very well for my projects for many many years.

More Markdown details are available in Github here:

https://github.com/cajuncoding/PdfTemplating.XslFO

/*
Copyright 2012 Brandon Bernard

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	 http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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 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.

This package has no dependencies.

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
3.1.0 6,323 6/25/2022
3.0.0 415 6/24/2022
2.0.0 6,757 4/1/2021
1.0.0 2,123 3/19/2020

Initial package upload for PdfTemplating with Xslt Templates.