Scryber 6¶
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.
}
}
}
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.
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.
Drawing and Typographic support¶
Scryber supports inclusion of Images, Fonts (inc. Google fonts) and SVG components for drawing graphics and icons.
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
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
Secure and Encrypted¶
Scryber fully supports the PDF restrictions and both 40 bit and 128 bit encryption of documents using owner and user passwords.
- 1.1. Console or GUI - Getting Started
- 1.2. MVC Controller - Getting Started
- 1.3. Why Scryber, and why not.
- 1.4. Scryber packages and the libraries - TD
- 1.5. Using the documentation Samples
- 1.6. Parsing documents from content
- 1.7. Document parameters and binding
- 1.8. Styles, Classes and selectors
- Output to files, streams or results - TD
- Version History
- Document Overview - TD
- Using units and measures - PD
- Using Colours, fills, borders and backgrounds - PD
- Using fonts and text styles - PD
- Securing Documents - PD
- Processing instruction and logging - TD
- Scryber Trace log details - PD
- Document outline (or bookmarks) - PD
- Class Hierarchy - PD
- XHTML Template
- The same in code
- The same in XLinQ
- Loading partial content
- Why use one over the other
- Lifecycle of a document creation - PD
- Splitting into multiple files - PD
- Styles in your template - PD
- Column layout - PD
- Textual Layout - PD
- Aligning your content - PD
- Sizing your content - PD
- Positioning your content - PD
- Borders on blocks - TD
- Strokes on components - TD
- Backgrounds on blocks - TD
- Fills on components - TD
- Images as backgrounds and fills - PD
- Linear and Radial Gradients - TD
- Textual wrapping and spacing - PD
- Transformations - TD
- Floats and positions - TD
- @page support - TD
- Building styles in code
- Building styles in code
- Dynamic content in your template - PD
- The ‘handlebars’ syntax - TD
- Bindiable properties - TD
- CSS var() and calc support - TD
- Visual decisions with binding - TD
- Available expression functions - TD
- Operators reference - TD
- The Document Params dictionary - TD
- Binding to events - TD
- Controllers for your templates - PD
- Binding Performance and style caching - PD
- Extending Scryber - TD
- When to declare it
- IFunction interface
- Implementing a function
- When to declare it
- IFunction interface
- Implementing a function
- Scryber Configuration Opions - TD
- Extending images and image factories - TD
- Security and encryption options - TD
- When to declare it
- IFunction interface
- Implementing a function
- Scryber library namespaces - TD
- Namespaces and their Assemblies - PD
- Paramter types and the model - PD