Scryber.Core
5.0.3-alpha
See the version list below for details.
dotnet add package Scryber.Core --version 5.0.3-alpha
NuGet\Install-Package Scryber.Core -Version 5.0.3-alpha
<PackageReference Include="Scryber.Core" Version="5.0.3-alpha" />
paket add Scryber.Core --version 5.0.3-alpha
#r "nuget: Scryber.Core, 5.0.3-alpha"
// Install Scryber.Core as a Cake Addin #addin nuget:?package=Scryber.Core&version=5.0.3-alpha&prerelease // Install Scryber.Core as a Cake Tool #tool nuget:?package=Scryber.Core&version=5.0.3-alpha&prerelease
scryber.core
Make documents easily.
The scryber engine is an advanced, complete, pdf creation library for dotnet core. It supports the easy definition of documents, pages, content, shapes and images either by xml templates or simple code.
With a styles based layout it is easy to create good looking and flowing documents. Binding in xml allows you to quickly load data from many sources and output to PDF.
Getting Started
The easiest way to begin is to use the Nuget Packages here
scryber.core package (Base libraries for GUI or console applications)
OR for asp.net mvc
scryber.core.mvc package (Which includes the scryber.core package).
The full documentation is available here
Hello World
Just a bit more than a hello world example.
Create your template pdfx (xml) file.
<?xml version="1.0" encoding="UTF-8" ?>
<doc:Document xmlns:doc='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Components.xsd'
xmlns:styles='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Styles.xsd'
xmlns:data='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Data.xsd'
title='Hello World' >
<Params>
<doc:Object-Param id='model' />
</Params>
<Info >
<Title>Hello World</Title>
</Info>
<Styles>
<styles:Style match='doc:Page'>
<styles:Font family='sans-serif' size='14pt' />
</styles:Style>
<styles:Style match='p.header' >
<styles:Background color='#333'
img-src='../html/images/ScyberLogo2_alpha_small.png' repeat='None'
x-pos='10pt' y-pos='10pt' x-size='20pt' />
<styles:Fill color='#AAA' />
<styles:Margins top='0pt' />
<styles:Padding all='10pt' left='35pt' />
</styles:Style>
</Styles>
<Pages>
<doc:Page styles:padding='0pt'>
<Header>
<doc:Para styles:class='header'>Scryber document creation</doc:Para>
</Header>
<Content>
<doc:Div styles:padding='10pt' >
<doc:H2 styles:style='{@:model.TitleStyle}' text='{@:model.Title}' />
<doc:Div>We hope you like scryber.</doc:Div>
</doc:Div>
</Content>
</doc:Page>
</Pages>
</doc:Document>
Or using XHTML
<!DOCTYPE HTML >
<html lang='en' xmlns='http://www.w3.org/1999/xhtml' >
<head>
<meta charset='utf-8' name='author' content='Richard Hewitson' />
<title>Hello World</title>
<style>
body{
font-family: sans-serif;
font-size: 14pt;
}
p.header {
color: #AAA;
background-color: #333;
background-image: url('../html/images/ScyberLogo2_alpha_small.png');
background-repeat: no-repeat;
background-position: 10pt 10pt;
background-size: 20pt 20pt;
margin-top: 0pt;
padding: 10pt 10pt 10pt 35pt;
}
</style>
</head>
<body>
<header>
<p class="header">Scryber document creation</p>
</header>
<div style="padding:10pt" >
<h2 class="heading" style="{@:model.TitleStyle}" >{@:model.Title}</h2>
<div>We hope you like scryber.</div>
</div>
</body>
</html>
From your application code.
//using Scryber.Components
static void Main(string[] args)
{
using(var doc = Document.ParseDocument("[input template]"))
{
doc.Params["model"] = new
{
Title = "This is the title",
TitleStyle = "color:red;"
};
doc.ProcessDocument("[output file].pdf");
}
}
Or from an MVC web application
//using Scryber.Components
//using Scryber.Components.Mvc
public IActionResult HelloWorld(string title = "This is the title")
{
using(var doc = Document.ParseDocument("[input template]"))
{
doc.Params["model"] = new
{
Title = title,
TitleStyle = "color:red;"
};
return this.PDF(doc); // inline:false, outputFileName:"HelloWorld.pdf"
}
}
And the output
Check out Read the Docs for more information on how to use the library.
Getting Involved
We would love to hear your feedback. Feel free to get in touch. Issues, ideas, includes are all welcome.
If you would like to help with building, extending then happy to get contributions
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
net5.0
- Microsoft.Extensions.Configuration (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
- Newtonsoft.Json (>= 12.0.3)
- Scryber.Core.OpenType (>= 5.0.0-alpha)
- System.Configuration.ConfigurationManager (>= 5.0.0)
- System.Drawing.Common (>= 5.0.0)
- System.Resources.Extensions (>= 5.0.0)
- System.Text.Encoding (>= 4.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Scryber.Core:
Package | Downloads |
---|---|
Scryber.Core.Mvc
The Mvc extensions for the Scryber.Core PDF creation engine - change the way you make documents. Scryber is an advanced PDF generation engine based around HTML templates with CSS styles and SVG drawing, or just code it. It includes full flowing pages, dynamic template binding on your object model and referenced external files, images, css and fonts. Easily create documents from your Apps, MVC sites, or Javascipt ajax calls. This framework is built entirely in .NET6 and Net Standard 2.0 and is released under the LGPL licence so you can use to it in commercial applications. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Scryber.Core:
Repository | Stars |
---|---|
grandnode/grandnode2
Open-Source eCommerce Platform on .NET Core, MongoDB, AWS DocumentDB, Azure CosmosDB, LiteDB & Vue.js
|
|
richard-scryber/scryber.core
Scryber.Core is a dotnet 6 html to pdf engine written entirely in C# for creating beautiful flowing documents from html templates including css styles, object data binding and svg drawing.
|
Version | Downloads | Last updated | |
---|---|---|---|
6.0.4-beta | 10,709 | 1/12/2024 | |
6.0.3.2-beta | 9,057 | 10/6/2023 | |
6.0.3.1-beta | 651 | 10/6/2023 | |
6.0.3-beta | 677 | 10/5/2023 | |
6.0.2.1-beta | 993 | 9/18/2023 | |
6.0.2-alpha | 3,676 | 5/4/2023 | |
6.0.1.3-beta | 643 | 9/18/2023 | |
6.0.1-beta | 11,191 | 3/24/2023 | |
6.0.0.16-beta | 1,794 | 3/1/2023 | |
6.0.0.14-beta | 15,627 | 1/1/2023 | |
6.0.0.13-beta | 1,147 | 12/6/2022 | |
6.0.0.10-beta | 1,092 | 10/6/2022 | |
6.0.0.9-beta | 2,572 | 9/30/2022 | |
6.0.0.8-beta | 1,941 | 9/23/2022 | |
6.0.0.6-beta | 768 | 9/23/2022 | |
6.0.0.5-beta | 978 | 9/16/2022 | |
6.0.0.4-beta | 937 | 9/16/2022 | |
5.1.0.2-beta | 12,339 | 8/31/2021 | |
5.1.0.1-beta | 1,747 | 7/27/2021 | |
5.1.0-beta | 1,163 | 7/19/2021 | |
5.0.7 | 54,703 | 6/16/2021 | |
5.0.7-alpha | 829 | 4/29/2021 | |
5.0.6.3 | 2,789 | 4/9/2021 | |
5.0.6.2-beta | 778 | 4/7/2021 | |
5.0.6.1-beta | 871 | 4/6/2021 | |
5.0.6 | 991 | 3/30/2021 | |
5.0.5.4 | 1,337 | 3/30/2021 | |
5.0.5.3-beta | 964 | 3/13/2021 | |
5.0.5.2-beta | 876 | 3/12/2021 | |
5.0.5.1 | 1,418 | 3/5/2021 | |
5.0.5 | 1,350 | 2/26/2021 | |
5.0.5-beta | 923 | 2/21/2021 | |
5.0.4 | 1,880 | 1/30/2021 | |
5.0.3 | 1,263 | 1/18/2021 | |
5.0.3-beta | 901 | 1/12/2021 | |
5.0.3-alpha | 1,006 | 1/4/2021 | |
5.0.1-alpha | 1,052 | 12/30/2020 | |
1.0.2-alpha | 892 | 12/15/2020 | |
1.0.1-alpha | 978 | 9/14/2020 | |
1.0.0.25 | 2,562 | 9/1/2020 | |
1.0.0.24 | 1,523 | 8/18/2020 | |
1.0.0.23 | 1,373 | 8/16/2020 | |
1.0.0.5 | 1,285 | 6/19/2020 | |
1.0.0.3 | 1,424 | 6/10/2020 | |
1.0.0.1 | 1,190 | 5/23/2020 | |
0.9.0 | 1,203 | 5/23/2020 |
5.0.3-alpha
Added support for HTML binding with the template tag and data-bind attribute. Along with fixes for single character css values and other minor updates.
5.0.1-alpha
Increased support for the HTML parsing with entities and DTD, along with the upgrade to dotnet 5
1.0.1-alpha
Significant updates to the Components namespace (removing the PDF prefix); support for the match='' style attribute; prioritizing style application based on selectors and complexity; direct parsing of XHTML; and support for styles based page breaking. With updated unit tests
1.0.0.25
-----------------
Updated and improved HTML and Markdown handling.
1.0.0.24
-------------------
Package for release to Nuget Public
Updated for the allow missing images option and fixed height and width for 0 resolution
Added the xsd files to the root of the components project
Added a readme.txt file
Added column-widths to the components and styles, with support for varable widths.
Page numbering falls back to the page number format set on the page if not explicitly set.
Removed the Page number prefix instead only supprting the page number display format
Updated to add the static cache provider service
Added the template property to the Placeholder, and support for updating templates to parameters
Stronger typing on the parameters and object parameter, and support for XML pararmeters as XPath or XNode values.
Passing any controller to the template generation so that it can be used to bind to events in templates.
Updated the data components for ForEach, With, If, Choose:When to be able to use xpath and object binding expressions on the value property.
Updated the PDFUser Component to use Params not Items
Updated the bindings and Params. Autobind on the document defaults to true.
Added the binding expressions as default in the parsing options
Fixed the query string overrides on the item native values
PDFDocument fix for remote references.
1.0.0.5
Fixes for path mapping on Mac / Unix / Windows when loading reference paths. Updated for the schema references and scrybersettings.json in the Scryber.Core.Schemas package
Added the default namespaces to the ParsingOptions, and updated version to match MVC and OpenType