Skip to content

Template engine for generating pdf documents

License

Notifications You must be signed in to change notification settings

maarten-vos/dotpdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotpdf dotpdf MyGet Build Status

Create PDF documents using templates written in JSON

Currently there isn't much documentation for dotpdf, but because it uses pdfsharp for document creation its documentation is a good source of information.

Features

  • Standard static templates
  • Data injection during runtime

Installation

Install it using NuGet!

Just add https://www.myget.org/F/dotpdf/api/v2 as a package source in your NuGet package manager.

Usage

First you need a template, here's a basic one as an example:

{
  "PageSetup": {
    "LeftMargin": "1cm",
    "RightMargin": "1cm",
    "TopMargin": "1cm"
  },
  "#Children": [
    {
      "#Type": "Paragraph",
      "#CompiledText": "\"Hello, \" + Obj.Name"
    }
  ]
}

After that you need to create your DocumentBuilder and provide the required arguments to the GetDocumentRenderer method.

var template = File.ReadAllText($"./basic_template.json");
var data = JObject.FromObject(new {Name = "John Smith", Time = DateTime.Now});
var builder = new DocumentBuilder();
builder.GetDocumentRenderer(data, templateJson).Save("./document.pdf");

About

Template engine for generating pdf documents

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages