Ibex.PDF.Creator
6.4.7.1
See the version list below for details.
dotnet add package Ibex.PDF.Creator --version 6.4.7.1
NuGet\Install-Package Ibex.PDF.Creator -Version 6.4.7.1
<PackageReference Include="Ibex.PDF.Creator" Version="6.4.7.1" />
paket add Ibex.PDF.Creator --version 6.4.7.1
#r "nuget: Ibex.PDF.Creator, 6.4.7.1"
// Install Ibex.PDF.Creator as a Cake Addin #addin nuget:?package=Ibex.PDF.Creator&version=6.4.7.1 // Install Ibex.PDF.Creator as a Cake Tool #tool nuget:?package=Ibex.PDF.Creator&version=6.4.7.1
Ibex.PDF.Creator
Ibex is a scalable standards-compliant PDF creation component for .Net.
See https://www.xmlpdf.com for more information.
Ibex helps you quickly create complex documents providing complete control over page layout and content. Ibex supports a wide range of layout functionality including page headers and footers, multi-column pages, page numbering, cross-referencing, footnotes, index creation and much more.
Ibex supports complex table layouts like this:
including cells which span multiple rows and columns, aligning data on decimal points regardless of font size, conditional headers and footers (for saying "continued on next page"), conditional borders at page breaks and lots more.
Bookmarks can be automatically generated using XSLT, including clickable page numbers which link to the correct page in the document:
Ibex supports SVG images including transparency, linear and radial gradients, and SVG images which contain other bitmap images:
A simple example using Ibex .NET from C#
This example shows how to call Ibex from a C# program and create a PDF file from XML and XSL files.
In this example we use an XML file containing the data we want to get into the PDF file, and and XSL stylesheet which transforms the XML into the FO syntax which Ibex understands. The XML file
The XML used in this example contains text held in one or more paragraph elements. It looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<text>
<para>hello world</para>
</text>
An XSL stylesheet is used to transform the XML into XSL-FO syntax. Using a stylesheet means that when the data changes (in the XML file) we do not have to make any changes to the C# program or the XSL stylesheet. If we add new elements to the XML which we want to appear in the PDF file, then we will need to change the XSL stylesheet, but we won't have to change the C# program. And changing the XSL is simple because we don't need to recompile it and can just use a text editor to maintain it.
The XSL used in this example looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/XSL/Format"
xmlns:ibex="http://www.xmlpdf.com/2003/ibex/Format">
<xsl:strip-space elements="*"/>
<xsl:template match="text">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="page-layout">
<fo:region-body margin="2.5cm" region-name="body" background-color="#dddddd"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page-layout">
<fo:flow flow-name="body">
<xsl:apply-templates select="para"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="para">
<fo:block>
<xsl:apply-templates select="text()"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Basically what this XSL does it output the <fo:root> element of the FO file, which contains the fo:layout-master-set defining the page structure, and then output each <para> element from the XML inside an FO block element.
The C# program used in this example is:
using ibex4;
public class HelloWorld {
static void Main( string[] args ) {
if( args.Length < 3 ) {
Console.WriteLine( "usage:hello xml-file xsl-file pdf-file" );
return;
}
FileStream xml = new FileStream( args[0], FileMode.Open, FileAccess.Read );
FileStream xsl = new FileStream( args[1], FileMode.Open, FileAccess.Read );
FileStream pdf = new FileStream( args[2], FileMode.Create, FileAccess.Write );
FODocument doc = new FODocument();
doc.generate( xml, xsl, pdf );
}
}
What this program does is:
- check that we have 3 arguments;
- create streams for input of the XML and XSL, and output of the PDF;
- create an Ibex FODocument object;
- call the generate() method to create the PDF file.
The program can be compiled from the command line, linking Ibex like this:
Create a new project class, for example, "hello"
dotnet new console --name hello
cd hello
dotnet add package Ibex.PDF.Creator
edit the Program.cs file created when the project was created and replace its contents with this:
using ibex4;
public class HelloWorld {
static void Main( string[] args ) {
if( args.Length < 3 ) {
Console.WriteLine( "usage:hello xml-file xsl-file pdf-file" );
return;
}
FileStream xml = new FileStream( args[0], FileMode.Open, FileAccess.Read );
FileStream xsl = new FileStream( args[1], FileMode.Open, FileAccess.Read );
FileStream pdf = new FileStream( args[2], FileMode.Create, FileAccess.Write );
FODocument doc = new FODocument();
doc.generate( xml, xsl, pdf );
}
}
build the project
dotnet build
This creates the program hello.exe. To run it we pass the names of the XML, XSL and PDF files on the command line like this:
dotnet run hello.xml hello.xsl hello-world.pdf
This will create the file hello.pdf containing the data from hello-world.xml.
See https://www.xmlpdf.com for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 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. |
-
net6.0
- SixLabors.ImageSharp (>= 2.1.1)
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 | |
---|---|---|---|
6.9.0.2-beta | 87 | 8/7/2024 | |
6.9.0.1-beta | 70 | 8/6/2024 | |
6.8.0.6 | 590 | 10/2/2024 | |
6.8.0.5 | 271 | 9/23/2024 | |
6.8.0.4 | 216 | 9/8/2024 | |
6.8.0.3 | 553 | 8/9/2024 | |
6.8.0.2 | 224 | 7/24/2024 | |
6.8.0.1 | 218 | 6/24/2024 | |
6.7.0.5 | 102 | 6/24/2024 | |
6.7.0.4 | 95 | 6/24/2024 | |
6.7.0.3 | 443 | 6/10/2024 | |
6.7.0.3-beta | 90 | 6/10/2024 | |
6.7.0.1-beta | 79 | 6/9/2024 | |
6.6.2.6 | 302 | 5/29/2024 | |
6.6.2.5 | 335 | 5/28/2024 | |
6.6.2.4 | 123 | 5/21/2024 | |
6.6.2.3 | 102 | 5/13/2024 | |
6.6.2.2 | 236 | 3/24/2024 | |
6.6.1.3 | 964 | 2/13/2024 | |
6.6.1.2 | 120 | 2/13/2024 | |
6.6.1.1 | 1,515 | 12/11/2023 | |
6.5.1.9 | 6,961 | 10/31/2023 | |
6.5.1.8 | 230 | 10/8/2023 | |
6.5.1.7 | 245 | 10/2/2023 | |
6.5.1.6 | 180 | 9/21/2023 | |
6.5.1.5 | 191 | 9/12/2023 | |
6.5.1.4 | 134 | 9/12/2023 | |
6.5.1.2 | 1,787 | 6/25/2023 | |
6.5.1.1 | 1,196 | 6/1/2023 | |
6.5.0.9 | 148 | 5/29/2023 | |
6.5.0.8 | 255 | 5/23/2023 | |
6.5.0.7 | 146 | 5/22/2023 | |
6.5.0.6 | 179 | 5/14/2023 | |
6.5.0.5 | 142 | 5/14/2023 | |
6.5.0.3 | 137 | 5/13/2023 | |
6.5.0.2 | 141 | 5/13/2023 | |
6.5.0.1 | 153 | 5/13/2023 | |
6.4.9.4 | 3,957 | 2/13/2023 | |
6.4.9.3 | 1,491 | 10/9/2022 | |
6.4.9.2 | 475 | 9/16/2022 | |
6.4.7.1 | 413 | 8/31/2022 | |
6.4.6.1 | 373 | 8/29/2022 | |
6.4.4.1-beta | 138 | 8/26/2022 | |
6.4.3.1 | 452 | 8/17/2022 | |
6.4.2 | 5,388 | 5/9/2022 | |
6.4.1 | 412 | 5/9/2022 | |
6.3.1 | 418 | 5/9/2022 | |
6.2.6 | 448 | 4/3/2022 | |
6.2.4 | 448 | 4/2/2022 | |
6.2.3 | 442 | 3/30/2022 | |
6.2.2 | 450 | 3/27/2022 | |
6.2.1 | 531 | 3/19/2022 | |
6.1.1 | 563 | 3/6/2022 | |
6.0.20-beta | 180 | 2/23/2022 | |
6.0.1-beta | 177 | 2/12/2022 | |
6.0.0-beta | 181 | 2/11/2022 |