GithubHelp home page GithubHelp logo

valks / razorpdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from razorant/razorpdf

0.0 2.0 0.0 1.53 MB

Simple project for making PDFs from Razor views in ASP.NET MVC

Home Page: http://nyveldt.com/blog/page/razorpdf

License: Apache License 2.0

C# 100.00%

razorpdf's Introduction

RazorPDF Core

RazorPDF is a simple project that makes it a breeze to create PDFs using the Razor view engine. Since Razor is really a template syntax, it can do lot more than just generate HTML. RazorPDF uses it to generate iText XML. Then using the iTextSharp library, we turn that iText XML into a PDF to return. The end result is a easy to use, clean method for generating PDFs.

Installation

PLEASE NOTE: This installation only applies to the original package

For Visual Studio 2015 use the Package Manager Console to install RazorPDFCore (https://www.nuget.org/packages/RazorPDFCore/)

PM> Install-Package RazorPDFCore

or download it from here and add it as additional project

Usage

Add the PdfResultExecutor service into your Startup.cs

public void ConfigureServices(IServiceCollection services) {
    // [...]
    services.AddSingleton<PdfResultExecutor>();
}

Return the below command in your controller action

ViewPdf(object model, string fileName, string viewName, bool download)

Example:

class YourBaseController : RazorPDF.Controller {
    // [...]
    public IActionResult Pdf() {
        var model = /* any model you wish */
        return ViewPdf(model);
    }
}

PLEASE NOTE: This method becomes ONLY available, when you use the inherited Controller class RazorPDF.Controller

Changelog

1.0.7

  • extend PdfResult to defined PageSize properties

1.0.6

  • updated AspNetCore v2.0

1.0.5

  • updated AspNetCore v1.1.3

1.0.3

  • make use of the XMLWorker instead to give more html/css flexibility

1.0.2

  • replaced *.csproj with *.xproj

1.0.1

  • updated source code to work with ASP.NET Core (tested on v1.0.1)

1.0.0

  • forked from RazorAnt/RazorPDF

razorpdf's People

Contributors

razorant avatar ole1986 avatar

Watchers

James Cloos avatar Wayne Adams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.