Scryber.Core 5.0.5.4

The scryber pdf engine for dotnet 5 - change the way you make documents.

Scryber is an advanced PDF generation engine based around HTML templates with CSS styles and SVG drawing. 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 .NET5 and is released under the LGPL licence so you can use to it in commercial applications.

There is a newer version of this package available.
See the version list below for details.
Install-Package Scryber.Core -Version 5.0.5.4
dotnet add package Scryber.Core --version 5.0.5.4
<PackageReference Include="Scryber.Core" Version="5.0.5.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Scryber.Core --version 5.0.5.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Scryber.Core, 5.0.5.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Scryber.Core as a Cake Addin
#addin nuget:?package=Scryber.Core&version=5.0.5.4

// Install Scryber.Core as a Cake Tool
#tool nuget:?package=Scryber.Core&version=5.0.5.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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.

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.

scryber.core documentation

Example Template

Create a new html template file with your content.


    <!DOCTYPE HTML >
    <html lang='en' xmlns='http://www.w3.org/1999/xhtml' >
        <head>
            <!-- support for standard document attributes -->
            <meta charset='utf-8' name='author' content='Richard Hewitson' />
            <title>Hello World</title>

            <!-- support for complex css selectors (or link to external style sheets )-->
            <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>
                <!-- document headers -->
                <p class="header">Scryber document creation</p>
            </header>
            <!-- support for many HTML5 tags-->
            <main style="padding:10pt">

                <!-- binding style and values on content -->
                <h2 style="{@:model.titlestyle}">{@:model.title}</h2>
                <div>We hope you like it.</div>
                <!-- Loop over or nested items binding in the parameters -->
                <ol>
                    <template data-bind='{@:model.items}'>
                        <!-- and bind the name value in the current object -->
                        <li>{@:.name}</li> 
                    </template>
                </ol>
            </main>
            <footer>
                <!-- footers and page numbers -->
                <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

Hello World Output

Check out Read the Docs for more information on how to use the library.

scryber.core documentation

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

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.

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.

scryber.core documentation

Example Template

Create a new html template file with your content.


    <!DOCTYPE HTML >
    <html lang='en' xmlns='http://www.w3.org/1999/xhtml' >
        <head>
            <!-- support for standard document attributes -->
            <meta charset='utf-8' name='author' content='Richard Hewitson' />
            <title>Hello World</title>

            <!-- support for complex css selectors (or link to external style sheets )-->
            <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>
                <!-- document headers -->
                <p class="header">Scryber document creation</p>
            </header>
            <!-- support for many HTML5 tags-->
            <main style="padding:10pt">

                <!-- binding style and values on content -->
                <h2 style="{@:model.titlestyle}">{@:model.title}</h2>
                <div>We hope you like it.</div>
                <!-- Loop over or nested items binding in the parameters -->
                <ol>
                    <template data-bind='{@:model.items}'>
                        <!-- and bind the name value in the current object -->
                        <li>{@:.name}</li> 
                    </template>
                </ol>
            </main>
            <footer>
                <!-- footers and page numbers -->
                <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

Hello World Output

Check out Read the Docs for more information on how to use the library.

scryber.core documentation

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

Release Notes

5.0.5.4

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.1

Using parsed JSON in binding and applying all margins to left, right, top and bottom plus support for conformance on templates and background images

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.

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 .NET5 and is released under the LGPL licence so you can use to it in commercial applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
5.0.7 271 6/16/2021
5.0.7-alpha 69 4/29/2021
5.0.6.3 842 4/9/2021
5.0.6.2-beta 50 4/7/2021
5.0.6.1-beta 61 4/6/2021
5.0.6 93 3/30/2021
5.0.5.4 108 3/30/2021
5.0.5.3-beta 142 3/13/2021
5.0.5.2-beta 79 3/12/2021
5.0.5.1 262 3/5/2021
5.0.5 120 2/26/2021
5.0.5-beta 63 2/21/2021
5.0.4 360 1/30/2021
5.0.3 146 1/18/2021
5.0.3-beta 85 1/12/2021
5.0.3-alpha 150 1/4/2021
5.0.1-alpha 128 12/30/2020
1.0.2-alpha 115 12/15/2020
1.0.1-alpha 165 9/14/2020
1.0.0.25 264 9/1/2020
1.0.0.24 373 8/18/2020
1.0.0.23 271 8/16/2020
1.0.0.5 217 6/19/2020
1.0.0.3 202 6/10/2020
1.0.0.1 225 5/23/2020
0.9.0 227 5/23/2020
Show less