Cake.MarkdownToPdf 3.0.5

dotnet add package Cake.MarkdownToPdf --version 3.0.5                
NuGet\Install-Package Cake.MarkdownToPdf -Version 3.0.5                
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.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cake.MarkdownToPdf --version 3.0.5                
#r "nuget: Cake.MarkdownToPdf, 3.0.5"                
#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.5

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

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 786 5/31/2024
3.0.4 1,776 1/23/2023
3.0.3 572 1/23/2023
3.0.2 805 1/23/2023
3.0.1 835 1/23/2023
3.0.0 768 1/23/2023
2.5.3 774 1/23/2023
2.5.2 28,393 8/13/2019
2.5.1 1,023 7/25/2019
2.5.0 2,023 2/14/2019
0.5.5 1,337 10/26/2018
0.5.4 1,143 10/24/2018
0.5.3 1,950 6/13/2018
0.5.2 564 6/13/2018
0.4.7-preview 1,309 6/7/2018
0.4.6 1,764 1/8/2018
0.4.4 1,332 9/18/2017
0.4.3 1,284 9/15/2017
0.4.2 1,339 9/15/2017
0.4.0 1,383 9/11/2017
0.3.5 1,300 9/5/2017
0.3.4 1,240 9/5/2017
0.3.3 1,224 9/5/2017
0.3.2 1,243 9/5/2017
0.3.0 1,183 9/5/2017
0.2.2 1,247 9/4/2017
0.2.1 1,185 9/4/2017
0.2.0 1,239 9/4/2017
0.1.0 1,155 9/4/2017