Yan Cui
I help clients go faster for less using serverless technologies.
Following on from my last post on formatting a Markdown document into PDF using FSharp.Markdown.Pdf, if you don’t like the default styling (which I tried to mimic style Github formats Markdown documents with) you can set your own styling for the different types of Markdown elements by going down a level of abstraction.
The FSharp.Markdown.Pdf.MarkdownStyleNames module defines all the names of styles used to format the different Markdown elements (e.g. heading 1-6, code block, listing 1-3, etc.) into PDF. To override the default styles, you need to:
- Instantiate an instance of the Document type from the MigraDoc.DocumentObjectModel namespace.
- Add the predefined style names from the aforementioned MarkdownStyleNames module to the document’s collection of styles.
- Tweak the style to your liking.
- Call the FSharp.Markdown.Pdf.PdfFormatting.formatMarkdown function with the Document value.
- Voila! You now have an instance of PdfDocument which has been formatted with your custom styling.
to see these simple steps in action:
You can compare the original and customized PDF outputs here and here.
Whenever you’re ready, here are 4 ways I can help you:
- If you want a one-stop shop to help you quickly level up your serverless skills, you should check out my Production-Ready Serverless workshop. Over 20 AWS Heroes & Community Builders have passed through this workshop, plus 1000+ students from the likes of AWS, LEGO, Booking, HBO and Siemens.
- If you want to learn how to test serverless applications without all the pain and hassle, you should check out my latest course, Testing Serverless Architectures.
- If you’re a manager or founder and want to help your team move faster and build better software, then check out my consulting services.
- If you just want to hang out, talk serverless, or ask for help, then you should join my FREE Community.
Pingback: F# Weekly #26 2013 | Sergey Tihon's Blog