Scryber 6

Simple data driven documents.

Simple, data driven, good looking, documents from templates

Scryber is the engine to create dynamic PDF documents quickly and easily from XHTML templates with consistant styles, your own data, and an easy flowing layout. It’s open source; flexible; styles based; data driven and with a low learning curve.

Written entirely in C# for dotnet 5 using HTML, CSS and SVG.

Documentation for the 5.0.x versions is here 5.0.6 Read the docs here Documentation for previous 1.0.x pdfx versions for 1.0.0 Read the docs here

Hello World MVC

Download the nuget package

https://www.nuget.org/packages/Scryber.Core.Mvc

Start with a template. The xmlns namespace declaration is important.

<!DOCTYPE HTML >
<html lang='en' xmlns='http://www.w3.org/1999/xhtml' >
    <head>
        <title>{{hello}}</title>
    </head>
    <body>
        <div style='padding:10px'>{{hello}}.</div>
    </body>
</html>

And then generate your template in a view.

//add the namespaces
using Scryber.Components;
using Scryber.Components.Mvc;
using Microsoft.AspNetCore.Mvc;

public class HomeController : Controller
{

    private readonly IWebHostEnvironment _env;

    public HomeController(IWebHostEnvironment environment)
    {
        _env = environment;
    }

    [HttpGet]
    public IActionResult HelloWorld()
    {
        // get the path to where you have saved your template
        var path = _env.ContentRootPath;
        path = System.IO.Path.Combine(path, "Views", "PDF", "HelloWorld.html");

        //parsing the document creates a complete object graph from the content
        using(var doc = Document.ParseDocument(path))
        {
            doc.Params["hello"] = "Hello World";
            return this.PDF(doc); //convenience extension method to return the result.
        }
    }

}
_images/HelloWorldIndex.png

Getting Started

Check out 1.2. MVC Controller - Getting Started for a full MVC example with styles and binding. Or 1.1. Console or GUI - Getting Started for a full gui application example (with styles and binding)

Easy, and intuitive structure

Whether you are using xhtml templates or directly in code, scryber is quick and easy to build complex documents from your designs and data using standard xhtml.

2_document/document_overview

Intelligent flowing layout engine

In scryber, content can either be laid out explicitly, or jut flowing with the the page. Change the page size, or insert content and everything will adjust around it.

Components overview - TD

Cascading Styles

With a styles based structure, it’s easy to apply designs to templates. Use class names, id’s or component types, or nested selectors.

Styles in your template - PD

Drawing and Typographic support

Scryber supports inclusion of Images, Fonts (inc. Google fonts) and SVG components for drawing graphics and icons.

Drawing with SVG - PD

Binding to your data

With a simple handlebars binding notation it’s easy to add references to your data structures and pass information and complex data to your document from your model and more.

Now supporting full expressions support including css var and calc support

Dynamic content in your template - PD

Extensible Framework

Scryber was designed from the ground up to be extensible. If it doesn’t do what you need, then we think you can make it do it. With iFrame includes, a namespace based parser engine, and configuration options for images, fonts, binding it’s down to your imagination

Extending Scryber - TD

Secure and Encrypted

Scryber fully supports the PDF restrictions and both 40 bit and 128 bit encryption of documents using owner and user passwords.

Securing Documents - PD