Scryber.Core
9.0.0.1-rc.2
See the version list below for details.
dotnet add package Scryber.Core --version 9.0.0.1-rc.2
NuGet\Install-Package Scryber.Core -Version 9.0.0.1-rc.2
<PackageReference Include="Scryber.Core" Version="9.0.0.1-rc.2" />
<PackageVersion Include="Scryber.Core" Version="9.0.0.1-rc.2" />
<PackageReference Include="Scryber.Core" />
paket add Scryber.Core --version 9.0.0.1-rc.2
#r "nuget: Scryber.Core, 9.0.0.1-rc.2"
#addin nuget:?package=Scryber.Core&version=9.0.0.1-rc.2&prerelease
#tool nuget:?package=Scryber.Core&version=9.0.0.1-rc.2&prerelease
Scryber.Core PDF Engine
Scryber makes creating beautiful documents easy.
The scryber engine is an advanced, complete, pdf creation library for dotnet core.
It supports the easy definition of document templates with, pages, content, shapes and images using xhtml and/or code.
With a styles based template layout, it is easy to create good looking, paginated and flowing documents.
With dynamic content from you applications or sites it is easy to add dynamic data, and repeaters.
Now includes support for expressions in both templates and css styles.
scryber supports:
- standard html body, tables, lists, divs and spans and many newer html5 tags
- flowing and flexible layout with multiple pages in css sizes, along with page headers, footers and breaks, and page numbering
- cascading styles: linked, embedded or inline using css syntax and priority.
- databinding for dynamic content or style on simple and complex object models with repeating templates.
- embedding of external content,
- sizing and positioning of elements inline, block, relative or absolute.
- images and colours with text and shape fills, backgrounds and borders.
- multiple fonts, including google fonts, supporting text alignment; spacing; leading; decoration and breaking.
- Graphics support for drawing and paths and text.
- Password security and restrictions on pdf files.
- Full code support either as a whole document, or partial content, and controllers, along with the html/css templates.
- Document controllers for complete control of the layout
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).
Check out Read the Docs for more information on how to use the library.
Example Template
Create a new html template file with your content.
<!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>
/* use of css variables that can be changed at generation time */
:root{
--head-bg: #FFF;
--head-txt: #000;
--head-logo: url('../html/images/ScyberLogo2_alpha_small.png');
--head-space: 20px;
}
body{
font-family: sans-serif;
font-size: 14pt;
}
p.header {
color: var(--head-txt);
background-color: var(--head-bg);
background-image: var(--head-logo);
background-repeat: no-repeat;
background-position: var(--head-space) var(--head-space);
background-size: 20pt 20pt;
margin-top: 0pt;
padding: var(--head-space);
padding-bottom: calc(--head-space + 25pt); /* full calc support */
}
.foot td {
border: none;
text-align: center;
font-size: 10pt;
margin-bottom: 10pt;
}
</style>
</head>
<body>
<header>
<p class="header">Scryber document creation</p>
</header>
<main style="padding:10pt">
<h2 style="{{model.titlestyle}}">{{model.title}}</h2>
<div>We hope you like it.</div>
<ol>
<template data-bind='{{model.items}}'>
<li>{{.name}}</li>
</template>
</ol>
</main>
<footer>
<table class="foot" style="width:100%">
<tr>
<td>{{author}}</td>
<td><page /></td>
<td>Hello World Sample</td>
</tr>
</table>
</footer>
</body>
</html>
From your application code.
//using Scryber.Components
static void Main(string[] args)
{
//Load your template from a
var path = System.Environment.CurrentDirectory;
path = System.IO.Path.Combine(path, "../../../Content/HTML/READMESample.html");
//create our sample model data.
var model = new
{
titlestyle = "color:#ff6347",
title = "Hello from scryber",
items = new[]
{
new { name = "First item" },
new { name = "Second item" },
new { name = "Third item" },
}
};
using (var doc = Document.ParseDocument(path))
{
//pass values to the document, including css using params
doc.Params["author"] = "Scryber Engine";
doc.Params["--head-bg"] = "#333"; //Override for the header background
doc.Params["--head-txt"] = "#FFF";
//pass data paramters as needed, supporting simple values, arrays or complex classes.
doc.Params["model"] = model;
//And save it to a file or a stream
using (var stream = new System.IO.FileStream("READMESample.pdf", System.IO.FileMode.Create))
{
doc.SaveAsPDF(stream);
}
}
}
Or from an MVC web application
//using Scryber.Components
//using Scryber.Components.Mvc
public async IActionResult HelloWorld(string title = "This is the title")
{
using(var doc = Document.ParseDocument("[input template]"))
{
doc.Params["author"] = "Scryber Engine";
doc.Params["--head-bg"] = "#333"; //Override for the header background
doc.Params["--head-txt"] = "#FFF";
doc.Params["model"] = GetMyParameters(title);
//This will output to the response inline.
return await this.PDFAsync(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 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 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 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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. |
-
.NETStandard 2.0
- HtmlAgilityPack (>= 1.12.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
- SixLabors.ImageSharp (>= 2.1.10)
- System.Resources.Extensions (>= 8.0.0)
-
net6.0
- HtmlAgilityPack (>= 1.12.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
- SixLabors.ImageSharp (>= 2.1.10)
- System.Resources.Extensions (>= 8.0.0)
-
net8.0
- HtmlAgilityPack (>= 1.12.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
- SixLabors.ImageSharp (>= 2.1.10)
- System.Resources.Extensions (>= 8.0.0)
-
net9.0
- HtmlAgilityPack (>= 1.12.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
- SixLabors.ImageSharp (>= 2.1.10)
- System.Resources.Extensions (>= 8.0.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 (1)
Showing the top 1 popular GitHub repositories that depend on Scryber.Core:
Repository | Stars |
---|---|
grandnode/grandnode2
E-commerce platform built with ASP.NET Core using MongoDB for NoSQL storage
|
Version | Downloads | Last Updated | |
---|---|---|---|
9.0.0.1-rc.3 | 460 | 5/26/2025 | |
9.0.0.1-rc.2 | 128 | 5/22/2025 | |
9.0.0.1-rc.1 | 1,087 | 5/13/2025 | |
9.0.0.1-beta | 642 | 5/6/2025 | |
9.0.0-rc.1 | 212 | 5/13/2025 | |
9.0.0-beta | 140 | 5/6/2025 | |
8.0.0.2-beta | 2,107 | 3/19/2025 | |
8.0.0.1-beta | 651 | 2/17/2025 | |
6.0.4-beta | 25,370 | 1/12/2024 | |
6.0.3.2-beta | 12,929 | 10/6/2023 | |
6.0.3.1-beta | 694 | 10/6/2023 | |
6.0.3-beta | 719 | 10/5/2023 | |
6.0.2.1-beta | 1,116 | 9/18/2023 | |
6.0.2-alpha | 4,678 | 5/4/2023 | |
6.0.1.3-beta | 664 | 9/18/2023 | |
6.0.1-beta | 16,289 | 3/24/2023 | |
6.0.0.16-beta | 1,985 | 3/1/2023 | |
6.0.0.14-beta | 17,780 | 1/1/2023 | |
6.0.0.13-beta | 1,191 | 12/6/2022 | |
6.0.0.10-beta | 1,231 | 10/6/2022 | |
6.0.0.9-beta | 2,690 | 9/30/2022 | |
6.0.0.8-beta | 2,027 | 9/23/2022 | |
6.0.0.6-beta | 838 | 9/23/2022 | |
6.0.0.5-beta | 1,049 | 9/16/2022 | |
6.0.0.4-beta | 1,006 | 9/16/2022 | |
5.1.0.2-beta | 15,356 | 8/31/2021 | |
5.1.0.1-beta | 1,825 | 7/27/2021 | |
5.1.0-beta | 1,248 | 7/19/2021 | |
5.0.7 | 78,788 | 6/16/2021 | |
5.0.7-alpha | 918 | 4/29/2021 | |
5.0.6.3 | 2,864 | 4/9/2021 | |
5.0.6.2-beta | 845 | 4/7/2021 | |
5.0.6.1-beta | 933 | 4/6/2021 | |
5.0.6 | 1,094 | 3/30/2021 | |
5.0.5.4 | 1,426 | 3/30/2021 | |
5.0.5.3-beta | 1,049 | 3/13/2021 | |
5.0.5.2-beta | 939 | 3/12/2021 | |
5.0.5.1 | 1,516 | 3/5/2021 | |
5.0.5 | 1,420 | 2/26/2021 | |
5.0.5-beta | 991 | 2/21/2021 | |
5.0.4 | 1,954 | 1/30/2021 | |
5.0.3 | 1,337 | 1/18/2021 | |
5.0.3-beta | 989 | 1/12/2021 | |
5.0.3-alpha | 1,090 | 1/4/2021 | |
5.0.1-alpha | 1,151 | 12/30/2020 | |
1.0.2-alpha | 958 | 12/15/2020 | |
1.0.1-alpha | 1,042 | 9/14/2020 | |
1.0.0.25 | 2,644 | 9/1/2020 | |
1.0.0.24 | 1,597 | 8/18/2020 | |
1.0.0.23 | 1,463 | 8/16/2020 | |
1.0.0.5 | 1,352 | 6/19/2020 | |
1.0.0.3 | 1,491 | 6/10/2020 | |
1.0.0.1 | 1,266 | 5/23/2020 | |
0.9.0 | 1,344 | 5/23/2020 |
9.0.0.1-rc.2
Fixes for template parsing and added data-content to the template element, plus minor fixes and unit test updates. Second release candidate.
9.0.0.1-rc.1
Minor fixes for layout. First release candidate.
9.0.0.1-beta
Fixed a minor layout issue with multiple footer elementnamed components being applite to a page footer, and also header.
9.0.0.0-beta
Completely updated version for .NET 9.0 with support for html, css, svg and binding in a WASM compatible package with remote asset and content requests.
NOTE: If upgrading, PLEASE CHECK THE OUTPUT of your documents before releasing.
8.0.0.2-beta
Added a fix for the rounding of expression results on decimal and double values when the results are very small.
8.0.0.1-beta
Updated to net8.0 sdk and dependancies updated to the latest stable versions.
6.0.5.0-beta
Updated to net8.0 sdk and dependencies updated to latest version.
6.0.4.0-beta
Big updates to whitespace handling, support for and hyphens in line breaks.
6.0.3.2-beta
Fix for prioritising parsing unit values in invariant culture on OS's set to non-invariant culture.
6.0.3.1-beta
Minor fix for transforming svg components (that do not have explict position values).
6.0.3.0-beta
Added fixes for parsing (x)html content on systems not running the english culture. All numeric values are expected to be in english decimal notation - e.g. 1,0234.56 for values in CSS, styles, svg etc.
Unit testing works for non-english. May be a couple of values / options missed but hoping not.
Added the AddRange option to top level component wrapping lists - (Rows, Cells, Items, etc.) that accepts an IEnumerable<InnerType> instance.
6.0.2.1-beta
Added fix for large inline images. Tested SaveAsPDFAsync.
6.0.1.1-alfa
Support for SaveAsPDFTimer, to check for asyncronous execution in a single threaded
application - blazor (or windows forms?), using asyncronous loading of http requests for css images, fonts etc).
6.0.1.0-beta
We now support html - in many of its flavours, through the HTMLAgilityPack
Added parsing non-formal html documents and components from local and remote files (using the ParseHtml and ParseHtmlDocument on the Document class)
Added the data-content and data-content-type attributes to visual components so that html and xhtml content can be data bound into pages.
Added support for the hyphens css property and it's use in hypenating long text.
6.0.0.16-beta
Some Big additions and fixes
Added support for the css counters (reset, increment and the counter(s) functions)
Added support for css content properties
Added support for css ::before and ::after selectors
Added support for relative units in styles e.g. 30% and 0.5em - not supported in calc() with multiple units e.g calc(50% - 5px) will not work.
A lot of layout tests to get everything working - precisely.
6.0.0.14-beta
Added support for transformations including css transform property.
6.0.0.12-beta
Changed the reference for ImageSharp to the 2.1.3 Nuget package, rather than the dll.
Checks added for support on thread culture in dates and numbers.
6.0.0.10-beta
Added support for Netwtonsoft.Json and the System.Text.Json objects in binding expressions and templates too.
Along with adding SoryBy, MaxOf, EachOf, SelectWhere collection functions.
6.0.0.5-beta
Updated to the .net 6.0 sdk, now with support for running as a web assembly with asyncronous loads of stylesheets, images and fonts.
Some TTC and TTF font files do not render glyfs correctly, but working for many fonts.
5.1.0.2-beta
A major update that now fully supports expressions in attributes, css var and clac along with text, using the handlebars notation - {{...}}
This includes support for simple mathematical expressions from the document variables as welll as functions such as 'concat', 'if(value, 'true', 'false')' or 'index() + model.property'
5.0.7
Adding support for the float left and right within blocks along with css linear and radial gradients
5.0.6.3
Fixes an issue with some TTF fonts on Windows (specifically azure) to look for the best character mapping table, and multi-span text not flowing well due to some changes to try and get float working.
5.0.6
The April release is a bit of a catch up and fix with updates for:
Supporting parsed JSON objects in binding - along with std types and dynamic objects.
margin:value is applied to all margins even if explicit left, right etc. has been previously applied.
Conformance is now carried through to templates, so errors are not indavertantly raised inside the template.
Missing background images will not raise an error.
Support for data images (src='data:image/..') within content - thanks Dan Rusu!
Images are not duplicated within the output for the same source.
5.0.5
Multiple enhancements including
Embed and iFrame support.
Binding speed improvements for longer documents.
Support for border-left, border-right, etc
Support for encryption and restrictions
Support for base href in template files.
Classes and styles on templates are supported.
Added em, strong, strike, del, ins elements
Html column width and break inside
CSS and HTML Logging
Fixed application of multiple styles with the same word inside
Allow missing images on the document is now supported.
Contain fill style for background images.
See: https://scrybercore.readthedocs.io/en/latest/version_history.html for a full break down.