Skip to content

sc231997/PdfMakeNet

 
 

Repository files navigation

PdfMakeNet

c# wrapper for PdfMake.

Note: Before accesing the site please disable add blocker while on the site or whitelist it to PdfMakeNet work properly, you won't get any output with add blocker on.

Demo live site credits to sc231997.

Implemented and Pending Features

  • line-wrapping
  • text-alignments
    • left
    • right
    • centered
    • justified
  • numbered and bulleted lists
  • tables and columns
    • auto/fixed/star-sized widths
    • col-spans and row-spans
    • headers automatically repeated in case of a page-break
    • access to row number of table
    • access to layout functions
  • images
  • SVGs
  • vector graphics
  • convenient styling and style inheritance
  • page headers and footers
    • static or dynamic content
    • access to current page number and page count
  • background-layer
  • page dimensions and orientations
  • margins
  • custom page breaks
  • font embedding (default at the moment)
  • support for complex, multi-level (nested) structures
  • table of contents
  • Watermark
  • Extension methods for opening/printing/downloading the generated PDF
  • setting of PDF metadata (e.g. author, subject)
  • compression
  • encryption and access privileges
    • user password
    • owner password
    • printing
    • modifying
    • copying
    • annotating
    • filling forms
    • content accessibility
    • document assembly
  • client-side extension methods
    • download with the specified filename
    • open in same or another window
    • print auto-triggering print

Notes

This wrapper implements the same methods and options as pdfmake and will help you build pdfmake object structure more faster and easier using strong datatypes and some extension methods using c#.

Take note that this library as no server side render capabilities yet (Unless integration with NodeJs or any lib on c# that parses and executes javascript, if any one want these feature please file an issue with any recommendation or pull request).

Maybe is some near future PdfMakeNet and others js libs may be posible to execute over c# using Jint after they complete the implementations of ES5 and ES6 features.

I opened this issue on Jint repository to keep track of this. Run PdfMake on Jint

Another library that maybe another alternative ChakraCore

So based on the last sentence you still need to reference pdfmake.js and vfs_fonts.js files on your client or create your own pdfmake viewer for flawless integration.

Documentation

The code is already documented but if you want more documentation you can visit: https://pdfmake.github.io/docs/

Browsers Supported

https://pdfmake.github.io/docs/getting-started/client-side/supported-browsers/

Installation

Install Nuget Package

Install-Package PdfMakeNet -Version 1.0.5
Install-Package PdfMakeNet.Server.Extensions -Version 1.0.5

Include the pdfmake script and font

<script src='build/pdfmake.min.js'></script>
<script src='build/vfs_fonts.js'></script>

Basic Example

using PdfMakeNet;

var pdfmake = new PdfMake();
pdfmake.AddText(new PdfMakeText() 
{ 
  Alignment = Alingment.Center,
  BackgroundColor = "red",
  Bold = true,
  Color = "white",
  FontSize = 18,
  Italics = true,
  Text = "Hello World!"
});
Console.WriteLine(pdfmake.GetDocumentDefinition());

Issues

If you find any bug or issue please file an issue I will fix it as soon as posible.

Pull Request

Pull requests are welcome. Please submit a pull request letting me know if is a bug fix or new feature.

License

MIT

Contributors

About

c# wrapper for PdfMake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 79.6%
  • C# 19.7%
  • CSS 0.7%