All Projects → richard-scryber → scryber.core

richard-scryber / scryber.core

Licence: other
Scryber.Core is a dotnet 5 html to pdf engine written entirely in C# for creating beautiful flowing documents from html templates including css styles, object data binding and svg drawing.

Programming Languages

C#
18002 projects
HTML
75241 projects

Projects that are alternatives of or similar to scryber.core

Go Wkhtmltopdf
Golang commandline wrapper for wkhtmltopdf
Stars: ✭ 564 (+662.16%)
Mutual labels:  pdf-document, pdf-generation
Pdfgen
Simple C PDF Writer/Generation library
Stars: ✭ 200 (+170.27%)
Mutual labels:  pdf-document, pdf-generation
Printable Mockups
Create printable UI mockups & wireframes templates
Stars: ✭ 479 (+547.3%)
Mutual labels:  pdf-document, pdf-generation
pdf-creator-node
This package is used to generate HTML to PDF in Nodejs
Stars: ✭ 122 (+64.86%)
Mutual labels:  html-template, pdf-generation
laravel-print-api
Laravel package to access our print-api
Stars: ✭ 16 (-78.38%)
Mutual labels:  pdf-document, pdf-generation
pdftron-android-samples
PDFTron Android Samples
Stars: ✭ 30 (-59.46%)
Mutual labels:  pdf-document, pdf-generation
Labelmake
Declarative style JavaScript PDF generator library. Works on Node and the browser 🖨︎
Stars: ✭ 112 (+51.35%)
Mutual labels:  pdf-document, pdf-generation
Html Pdf Service
LGPL V3. Java Spring Boot microservice with RESTful webconsole and service endpoints that convert HTML to PDF, optionally styling with CSS and templating with JSON using Flying Saucer, PDF Box and Jackson libraries. Available on Docker Hub.
Stars: ✭ 12 (-83.78%)
Mutual labels:  html-template, pdf-generation
Expense Tracker with Pdf report
An expense Tracker 🔥🔥 which lets you add transactions 🖊🖊 and generate a pdf report of all of your transactions📋📋
Stars: ✭ 16 (-78.38%)
Mutual labels:  pdf-document, pdf-generation
pdfio
PDFio is a simple C library for reading and writing PDF files.
Stars: ✭ 55 (-25.68%)
Mutual labels:  pdf-document, pdf-generation
Android-XML-to-PDF-Generator
This library is for convert XML to PDF very easily using Step Builders Pattern
Stars: ✭ 140 (+89.19%)
Mutual labels:  pdf-document, pdf-generation
aesop
[DEPRECATED] The simplest PDF viewer around
Stars: ✭ 1 (-98.65%)
Mutual labels:  pdf-document
pdf-annotation-service
Client and service for embedding highlights into PDF documents
Stars: ✭ 32 (-56.76%)
Mutual labels:  pdf-generation
Nginxy
FancyIndex Theme for Nginx same appearance of Apaxy for apache
Stars: ✭ 34 (-54.05%)
Mutual labels:  html-template
weasydoc
Convert R Markdown to PDF Using Weasyprint (or Prince XML)
Stars: ✭ 40 (-45.95%)
Mutual labels:  pdf-generation
Pdf-Split-Merge
simple pdf file split and merge tool
Stars: ✭ 38 (-48.65%)
Mutual labels:  pdf-document
MarkdownIt
Efficient Code Editor to live render Markdown and save as Markdown,Html and Pdf with Instant Hosting in The Web.
Stars: ✭ 31 (-58.11%)
Mutual labels:  pdf-generation
cefHtmlSnapshot
Command-line utility for Windows take snapshots of HTML pages and save them as images or PDF
Stars: ✭ 23 (-68.92%)
Mutual labels:  pdf-generation
iDocs
iDocs is one page documentation html template which helps you to create your offline and online documentation for your themes, templates, plugins and software.
Stars: ✭ 75 (+1.35%)
Mutual labels:  html-template
static-html-template
静态页面网站快速开发环境,支持自动刷新页面,less样式预处理。
Stars: ✭ 19 (-74.32%)
Mutual labels:  html-template


scryber.core pdf engine

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>
            <!-- 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>
                /* 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>
                <!-- 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)
      {
            //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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].