Scryber.Core.Experimental 6.0.0-experimental

This is a prerelease version of Scryber.Core.Experimental.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Scryber.Core.Experimental --version 6.0.0-experimental                
NuGet\Install-Package Scryber.Core.Experimental -Version 6.0.0-experimental                
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.Experimental" Version="6.0.0-experimental" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Scryber.Core.Experimental --version 6.0.0-experimental                
#r "nuget: Scryber.Core.Experimental, 6.0.0-experimental"                
#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.Experimental as a Cake Addin
#addin nuget:?package=Scryber.Core.Experimental&version=6.0.0-experimental&prerelease

// Install Scryber.Core.Experimental as a Cake Tool
#tool nuget:?package=Scryber.Core.Experimental&version=6.0.0-experimental&prerelease                

Scryber makes creating beautiful documents easy.

The scryber engine is an advanced, complete, pdf creation library for dotnet core.

It supports the easy definition of document templates with, pages, content, shapes and images using xhtml and/or code.

With a styles based template layout, it is easy to create good looking, paginated and flowing documents.

With dynamic content from you applications or sites it is easy to add dynamic data, and repeaters.

Now uncludes support for expressions in both templates and css styles.

scryber supports:

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>
            
            <meta charset='utf-8' name='author' content='Richard Hewitson' />
            <title>Hello World</title>

            
            <style>
                /* use of css variables that can be changed at generation time */
                :root{
                    --head-bg: #FFF;
                    --head-txt: #000;
                    --head-logo: url('../html/images/ScyberLogo2_alpha_small.png');
                    --head-space: 20px;
                }

                body{
                    font-family: sans-serif;
                    font-size: 14pt;
                }

                p.header {
                    color: var(--head-txt);
                    background-color: var(--head-bg);
                    background-image: var(--head-logo);
                    background-repeat: no-repeat;
                    background-position: var(--head-space) var(--head-space);
                    background-size: 20pt 20pt;
                    margin-top: 0pt;
                    padding: var(--head-space);
                    padding-bottom: calc(--head-space + 25pt); /* full calc support */
                }

                .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)
      {
            //Load your template from a 
            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 values to the document, including css using params

                doc.Params["author"] = "Scryber Engine";
                doc.Params["--head-bg"] = "#333"; //Override for the header background
                doc.Params["--head-txt"] = "#FFF";
                
                //pass data paramters as needed, supporting simple values, arrays or complex classes.

                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 async IActionResult HelloWorld(string title = "This is the title")
      {
          using(var doc = Document.ParseDocument("[input template]"))
          {
              doc.Params["author"] = "Scryber Engine";
              doc.Params["--head-bg"] = "#333"; //Override for the header background
              doc.Params["--head-txt"] = "#FFF";

              doc.Params["model"] = GetMyParameters(title);

              //This will output to the response inline.
              return await this.PDFAsync(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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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-experimental 2,056 6/27/2022
6.0.0-experimental 179 4/29/2022

6.0.0.0-experimental

Scryber.Core "documentation" branch changes + base64 fonts + windows encoding fix

5.1.0.2-beta

A major update that now fully supports expressions in attributes, css var and clac along with text, using the handlebars notation - {{...}}
This includes support for simple mathematical expressions from the document variables as welll as functions such as 'concat', 'if(value, 'true', 'false')' or 'index() + model.property'

5.0.7

Adding support for the float left and right within blocks along with css linear and radial gradients

5.0.6.3

Fixes an issue with some TTF fonts on Windows (specifically azure) to look for the best character mapping table, and multi-span text not flowing well due to some changes to try and get float working.

5.0.6

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

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.