Scryber.Core.Mvc 5.0.3-alpha

This is a prerelease version of Scryber.Core.Mvc.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Scryber.Core.Mvc --version 5.0.3-alpha                
NuGet\Install-Package Scryber.Core.Mvc -Version 5.0.3-alpha                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Scryber.Core.Mvc" Version="5.0.3-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Scryber.Core.Mvc --version 5.0.3-alpha                
#r "nuget: Scryber.Core.Mvc, 5.0.3-alpha"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Scryber.Core.Mvc as a Cake Addin
#addin nuget:?package=Scryber.Core.Mvc&version=5.0.3-alpha&prerelease

// Install Scryber.Core.Mvc as a Cake Tool
#tool nuget:?package=Scryber.Core.Mvc&version=5.0.3-alpha&prerelease                

scryber.core

Make documents easily.

The scryber engine is an advanced, complete, pdf creation library for dotnet core. It supports the easy definition of documents, pages, content, shapes and images either by xml templates or simple code.

With a styles based layout it is easy to create good looking and flowing documents. Binding in xml allows you to quickly load data from many sources and output to PDF.

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

The full documentation is available here

scryber.core documentation

Hello World

Just a bit more than a hello world example.

Create your template pdfx (xml) file.


    <?xml version="1.0" encoding="UTF-8" ?>
    <doc:Document xmlns:doc='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Components.xsd'
                        xmlns:styles='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Styles.xsd'
                        xmlns:data='http://www.scryber.co.uk/schemas/core/release/v1/Scryber.Data.xsd'
                        title='Hello World' >
    <Params>
      <doc:Object-Param id='model'  />
    </Params>
    <Info >
        <Title>Hello World</Title>
    </Info>
    <Styles>
      
      <styles:Style match='doc:Page'>
        <styles:Font family='sans-serif' size='14pt' />
      </styles:Style>

      
      <styles:Style match='p.header' >
        <styles:Background color='#333'
                img-src='../html/images/ScyberLogo2_alpha_small.png' repeat='None' 
                x-pos='10pt' y-pos='10pt' x-size='20pt' />
        <styles:Fill color='#AAA' />
        <styles:Margins top='0pt' />
        <styles:Padding all='10pt' left='35pt' />
      </styles:Style>

    </Styles>

    <Pages>
  
      <doc:Page styles:padding='0pt'>
        
        <Header>
            <doc:Para styles:class='header'>Scryber document creation</doc:Para>
        </Header>
        <Content>
         
         <doc:Div styles:padding='10pt' >
            <doc:H2 styles:style='{@:model.TitleStyle}' text='{@:model.Title}' />
            <doc:Div>We hope you like scryber.</doc:Div>
          </doc:Div>
        </Content>
      </doc:Page>
    </Pages>

    </doc:Document>

Or using XHTML


    <!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;
                }
            </style>
        </head>
        <body>
            <header>
                <p class="header">Scryber document creation</p>
            </header>
            <div style="padding:10pt" >
                <h2 class="heading" style="{@:model.TitleStyle}" >{@:model.Title}</h2>
                <div>We hope you like scryber.</div>
            </div>
        </body>
    </html>

From your application code.


      //using Scryber.Components

      static void Main(string[] args)
      {
          using(var doc = Document.ParseDocument("[input template]"))
          {
              doc.Params["model"] = new
                {
                    Title = "This is the title",
                    TitleStyle = "color:red;"
                };
              
              doc.ProcessDocument("[output file].pdf");
          }
      }

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["model"] = new
                {
                    Title = title,
                    TitleStyle = "color:red;"
                };
              
              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 building, extending then happy to get contributions

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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,952 3/24/2023
6.0.0.16-beta 171 3/1/2023
6.0.0.14-beta 7,533 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 378 8/31/2021
5.1.0-beta 1,266 7/19/2021
5.0.7 8,364 6/16/2021
5.0.6.3 1,656 4/9/2021
5.0.6.1-beta 259 4/6/2021
5.0.6 523 3/30/2021
5.0.5.4 501 3/30/2021
5.0.5.1 487 3/5/2021
5.0.5 534 2/26/2021
5.0.5-beta 267 2/21/2021
5.0.4 1,137 1/30/2021
5.0.3 542 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 650 9/1/2020
1.0.0.24 520 8/18/2020
1.0.0.23 540 8/16/2020
1.0.0.6 501 6/20/2020
1.0.0.5 511 6/19/2020
1.0.0.4 474 6/11/2020

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