Cake.MarkdownToPdf 3.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Cake.MarkdownToPdf --version 3.0.4                
NuGet\Install-Package Cake.MarkdownToPdf -Version 3.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cake.MarkdownToPdf" Version="3.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cake.MarkdownToPdf --version 3.0.4                
#r "nuget: Cake.MarkdownToPdf, 3.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cake.MarkdownToPdf as a Cake Addin
#addin nuget:?package=Cake.MarkdownToPdf&version=3.0.4

// Install Cake.MarkdownToPdf as a Cake Tool
#tool nuget:?package=Cake.MarkdownToPdf&version=3.0.4                

Cake.MarkdownToPdf

Build status NuGet Version License

Cake addin to convert markdown files to pdf. This addin uses Markdig markdown processor.

Starting with Version 3.0 the adding requires a Wkhtmltopdf "installation". Please use a wkhtmltopdf package that fit your needs (version and platform).

Usage

Directly in your build script via a Cake #addin directive:

#addin "Cake.MarkdownToPdf"
#tool "nuget:?package=wkhtmltopdf.x64&version=0.12.6"

Task("Convert")
  .Does(() => {        
    MarkdownFileToPdf("readme.md", "output.pdf");
    
    // or markdown text
    MarkdownToPdf("Some markdown formated text...", "output.pdf");
    
    // or using settings
    MarkdownFileToPdf("readme.md", "output.pdf", settings => {
        settings.Theme = Themes.Github;

        // optional set path to your Wkhtmltopdf. Otherwise Cake will try to resolve it automatically.
        settings.ToolPath = "..\wkhtmltopdf.exe";

        settings.UseAdvancedMarkdownTables(); // or UseAdvancedMarkdownExtensions();
        
        // accessing the internal markdig markdown pipeline
        settings.MarkdownPipeline.UseGridTables();

        // optional
        settings.Debug = true; // do not delete generated html file
    });
});

Themes

Use can use the build-in "Default" or "Github" theme or define any css style on your own

Task("Convert")
  .Does(() => {        
    // custom css
    MarkdownFileToPdf("readme.md", "output.pdf", settings => {
        settings.CssFile = "path to my css";
        
        // optional
        settings.HtmlTemplateFile = "path to my custom html file"; // using {$html} placeholder       
    });
});

PDF settings

Settings such as orientation, margins etc can be set through the PdfSettings:

Task("Convert")
  .Does(() => {        
  
    MarkdownFileToPdf("readme.md", "output.pdf", settings => {
        settings.Pdf.PageSize = PdfPageSize.Letter;
        // check https://wkhtmltopdf.org/usage/wkhtmltopdf.txt for all available options
        settings.Pdf.AdditionalGlobalOptions = "--title \"READ ME\"";
        settings.Pdf.AdditionalPageOptions = "--default-header";
    });
});
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Cake.MarkdownToPdf:

Repository Stars
Phrynohyas/eve-o-preview
An EVE client window switcher tool created to aid playing with multiple clients in CCP game EVE Online
Version Downloads Last updated
3.0.5 798 5/31/2024
3.0.4 1,778 1/23/2023
3.0.3 574 1/23/2023
3.0.2 809 1/23/2023
3.0.1 839 1/23/2023
3.0.0 772 1/23/2023
2.5.3 778 1/23/2023
2.5.2 28,467 8/13/2019
2.5.1 1,026 7/25/2019
2.5.0 2,026 2/14/2019
0.5.5 1,340 10/26/2018
0.5.4 1,146 10/24/2018
0.5.3 1,953 6/13/2018
0.5.2 567 6/13/2018
0.4.7-preview 1,309 6/7/2018
0.4.6 1,767 1/8/2018
0.4.4 1,335 9/18/2017
0.4.3 1,287 9/15/2017
0.4.2 1,342 9/15/2017
0.4.0 1,386 9/11/2017
0.3.5 1,302 9/5/2017
0.3.4 1,242 9/5/2017
0.3.3 1,226 9/5/2017
0.3.2 1,245 9/5/2017
0.3.0 1,185 9/5/2017
0.2.2 1,249 9/4/2017
0.2.1 1,187 9/4/2017
0.2.0 1,241 9/4/2017
0.1.0 1,157 9/4/2017