Skip to content

CompileNix/RazorHtmlToPdfExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create new .Net Framework 8.1 / .Net 6 console application

install Nuget Packages:

  • itext7.pdfhtml
  • RazorLight

update csproj by adding the following:

<PropertyGroup>
    <!-- This group contains project properties for RazorLight on .NET Core -->
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
    <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>

<PropertyGroup>
    <LangVersion>10.0</LangVersion>
</PropertyGroup>

reload project

build and run code

further reading:

About

Example App to generate a PDF from a Razor template via HTML

Topics

Resources

License

Stars

Watchers

Forks

Languages