Scryber.Core.Mvc
6.0.0.14-beta
See the version list below for details.
dotnet add package Scryber.Core.Mvc --version 6.0.0.14-beta
NuGet\Install-Package Scryber.Core.Mvc -Version 6.0.0.14-beta
<PackageReference Include="Scryber.Core.Mvc" Version="6.0.0.14-beta" />
paket add Scryber.Core.Mvc --version 6.0.0.14-beta
#r "nuget: Scryber.Core.Mvc, 6.0.0.14-beta"
// Install Scryber.Core.Mvc as a Cake Addin #addin nuget:?package=Scryber.Core.Mvc&version=6.0.0.14-beta&prerelease // Install Scryber.Core.Mvc as a Cake Tool #tool nuget:?package=Scryber.Core.Mvc&version=6.0.0.14-beta&prerelease
Changing the way you can create documents.
The scryber engine is an advanced, complete, pdf creation library for dotnet core 5. It supports the easy definition of documents, pages, content, shapes and images with html as templates and data binding for custom content.
If you know HTML you can do it with documents.
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.
- cascading styles: linked, embedded or inline using css syntax and priority.
- databinding for dynamic content on simple and complex objects with repeating templates.
- iframe and embed imports of external content,
- sizing and positioning of elements inline, block, relative or absolute.
- images and colours with text and shape fills backgrounds and borders.
- SVG drawings and text.
- multiple fonts, including google fonts, with alignment; spacing; leading; decoration and breaking.
If you have used the previous pdfx files, the older templates should continue to work. But we will be concentrating on html, css and svg going forwards.
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>
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;
}
.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)
{
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 data paramters as needed, supporting simple values, arrays or complex classes.
doc.Params["author"] = "Scryber Engine";
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 IActionResult HelloWorld(string title = "This is the title")
{
using(var doc = Document.ParseDocument("[input template]"))
{
doc.Params["author"] = "Scryber Engine";
doc.Params["model"] = GetMyParameters(title);
//This will output to the response inline.
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 documentation, or building, and extending then really 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 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. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.2.0)
- Scryber.Core (>= 6.0.0.14-beta)
- SixLabors.ImageSharp (>= 2.1.3)
-
net6.0
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.2.0)
- Scryber.Core (>= 6.0.0.14-beta)
- SixLabors.ImageSharp (>= 2.1.3)
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.0.1-beta | 10,833 | 3/24/2023 |
6.0.0.16-beta | 168 | 3/1/2023 |
6.0.0.14-beta | 7,502 | 1/1/2023 |
6.0.0.13-beta | 162 | 12/6/2022 |
6.0.0.11-beta | 172 | 12/6/2022 |
6.0.0.8-beta | 328 | 9/23/2022 |
5.1.0.2-beta | 374 | 8/31/2021 |
5.1.0-beta | 1,263 | 7/19/2021 |
5.0.7 | 8,285 | 6/16/2021 |
5.0.6.3 | 1,653 | 4/9/2021 |
5.0.6.1-beta | 256 | 4/6/2021 |
5.0.6 | 520 | 3/30/2021 |
5.0.5.4 | 498 | 3/30/2021 |
5.0.5.1 | 484 | 3/5/2021 |
5.0.5 | 531 | 2/26/2021 |
5.0.5-beta | 264 | 2/21/2021 |
5.0.4 | 1,134 | 1/30/2021 |
5.0.3 | 539 | 1/18/2021 |
5.0.3-beta | 287 | 1/12/2021 |
5.0.3-alpha | 339 | 1/4/2021 |
5.0.2-alpha | 317 | 1/4/2021 |
5.0.1-alpha | 304 | 12/30/2020 |
1.0.1-alpha | 352 | 9/14/2020 |
1.0.0.25 | 647 | 9/1/2020 |
1.0.0.24 | 517 | 8/18/2020 |
1.0.0.23 | 537 | 8/16/2020 |
1.0.0.6 | 498 | 6/20/2020 |
1.0.0.5 | 508 | 6/19/2020 |
1.0.0.4 | 471 | 6/11/2020 |
6.0.0.14-beta
Added support for transformations including css transform property.
6.0.0.13-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.8-beta
Added support for Netwtonsoft.Json and the System.Text.Json objects in binding expressions
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 new release with support for expressions using the handlebars syntax {{...}}
5.0.7.0
Updates for linear and circular gradients and floating components within a block.
5.0.6.3
A fix for font character mappings on Windows and laying out mutliple spans on a single line
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.