Cake.MarkdownToPdf 3.0.4

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.4 1,695 1/23/2023
3.0.3 541 1/23/2023
3.0.2 753 1/23/2023
3.0.1 779 1/23/2023
3.0.0 722 1/23/2023
2.5.3 728 1/23/2023
2.5.2 22,769 8/13/2019
2.5.1 995 7/25/2019
2.5.0 1,983 2/14/2019
0.5.5 1,295 10/26/2018
0.5.4 1,111 10/24/2018
0.5.3 1,912 6/13/2018
0.5.2 549 6/13/2018
0.4.7-preview 1,276 6/7/2018
0.4.6 1,726 1/8/2018
0.4.4 1,289 9/18/2017
0.4.3 1,255 9/15/2017
0.4.2 1,298 9/15/2017
0.4.0 1,324 9/11/2017
0.3.5 1,271 9/5/2017
0.3.4 1,215 9/5/2017
0.3.3 1,202 9/5/2017
0.3.2 1,217 9/5/2017
0.3.0 1,148 9/5/2017
0.2.2 1,213 9/4/2017
0.2.1 1,158 9/4/2017
0.2.0 1,208 9/4/2017
0.1.0 1,124 9/4/2017