Export to pdf using ASP.NET 5

后端 未结 5 1734
暗喜
暗喜 2020-12-31 12:34

I am working on MVC 6 application(DNX Core 5.0 framework). Unfortunately, I don\'t find any library for pdf export.

Any help will be appreciated.

5条回答
  •  無奈伤痛
    2020-12-31 13:09

    Necromancing.

    Adding a dependency to NodeJS is subideal IMHO, especially considering .NET Core self-contained deployment.

    As per 2017, you could use my port of PdfSharpCore to .NET Core 1.1
    Resolves fonts, and it can use images. Comes with a nice sample application. You'll have to replace the DB part, however.

    Credits go to:
    https://github.com/groege/PdfSharpCore

    which is a bit outdated, and doesn't contain a sample on how to use it with images.

    Note that you need to register the font-resolver and the imageSource-Implementation before using the respective features:

    PdfSharpCore.Fonts.GlobalFontSettings.FontResolver = new FontResolver();
    
    MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel
        .Shapes.ImageSource.ImageSourceImpl = 
              new PdfSharpCore.ImageSharp.ImageSharpImageSource();
    

提交回复
热议问题