Scryber.Core.Mvc
5.0.3
See the version list below for details.
dotnet add package Scryber.Core.Mvc --version 5.0.3
NuGet\Install-Package Scryber.Core.Mvc -Version 5.0.3
<PackageReference Include="Scryber.Core.Mvc" Version="5.0.3" />
paket add Scryber.Core.Mvc --version 5.0.3
#r "nuget: Scryber.Core.Mvc, 5.0.3"
// Install Scryber.Core.Mvc as a Cake Addin #addin nuget:?package=Scryber.Core.Mvc&version=5.0.3 // Install Scryber.Core.Mvc as a Cake Tool #tool nuget:?package=Scryber.Core.Mvc&version=5.0.3
Change the way you 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 templates and simple code.
With a styles based template layout it is easy to create good looking, flowing documents with dynamic content from you applications or sites.
HTML First
The latest version of scryber makes a significant switch to an XHTML first approach. If you know HTML you can create 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 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.
- multiple fonts, including google fonts, supporting text 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 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.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.2.0)
- Scryber.Core (>= 5.0.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 | 11,074 | 3/24/2023 |
6.0.0.16-beta | 171 | 3/1/2023 |
6.0.0.14-beta | 7,564 | 1/1/2023 |
6.0.0.13-beta | 165 | 12/6/2022 |
6.0.0.11-beta | 175 | 12/6/2022 |
6.0.0.8-beta | 331 | 9/23/2022 |
5.1.0.2-beta | 380 | 8/31/2021 |
5.1.0-beta | 1,266 | 7/19/2021 |
5.0.7 | 8,454 | 6/16/2021 |
5.0.6.3 | 1,658 | 4/9/2021 |
5.0.6.1-beta | 259 | 4/6/2021 |
5.0.6 | 525 | 3/30/2021 |
5.0.5.4 | 503 | 3/30/2021 |
5.0.5.1 | 489 | 3/5/2021 |
5.0.5 | 536 | 2/26/2021 |
5.0.5-beta | 267 | 2/21/2021 |
5.0.4 | 1,139 | 1/30/2021 |
5.0.3 | 544 | 1/18/2021 |
5.0.3-beta | 290 | 1/12/2021 |
5.0.3-alpha | 342 | 1/4/2021 |
5.0.2-alpha | 320 | 1/4/2021 |
5.0.1-alpha | 307 | 12/30/2020 |
1.0.1-alpha | 355 | 9/14/2020 |
1.0.0.25 | 652 | 9/1/2020 |
1.0.0.24 | 522 | 8/18/2020 |
1.0.0.23 | 542 | 8/16/2020 |
1.0.0.6 | 503 | 6/20/2020 |
1.0.0.5 | 513 | 6/19/2020 |
1.0.0.4 | 476 | 6/11/2020 |
5.0.3
Public release of the dotnet 5 engine, supporting google fonts, full css files and html5
5.0.3-beta
Working with support for @page css directives for the whole document and section page sizes. Support for <page />
tags with property or for attributes. Fix for anchor links with internal and external href.
5.0.3-alpha
Added the support for html templating, fixed single character css values and other minor updates.
5.0.2-alpha
Added the support for parsing a view into a document, allowing for a model.
5.0.1-alpha
Increased support for HTML parsing using DTD entities and xhtml namespace, along with recompilation for the dotnet 5 framework.
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
v1.0.0.25
-----------------
Updated support for html and markdown
v1.0.0.24
-----------------
Release package for Nuget
Updated support for missing images
Added read me
Updated for the page numbering fallback
Updated for the code Page Numbering display format
Updated for the Caching Provider, and the pages style
Forcing the update to the PDFTemplateItemValue
Template Parameters values and Placeholder templates
Strongly typed parameter settings.
Updated to the latest Scryber.Core with template item controller binding.
Updated with new features in ForEach, With, If and Choose for the Value property
Linked to the Scryber.Core of the same version.
v1.0.0.5
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
v1.0.0.25
-----------------
Updated support for html and markdown
v1.0.0.24
-----------------
Release package for Nuget
Updated support for missing images
Added read me
Updated for the page numbering fallback
Updated for the code Page Numbering display format
Updated for the Caching Provider, and the pages style
Forcing the update to the PDFTemplateItemValue
Template Parameters values and Placeholder templates
Strongly typed parameter settings.
Updated to the latest Scryber.Core with template item controller binding.
Updated with new features in ForEach, With, If and Choose for the Value property
Linked to the Scryber.Core of the same version.
v1.0.0.5
Updated for of the Core library with atomatic inclusion of the http namespace references, and also added the model extension methods