VectSharp 2.5.0
A light library for C# vector graphics
|
Renders Markdown documents into VectSharp graphics objects. More...
Public Types | |
enum | VerticalAlignment |
Defines the options for the vertical alignment of table cells. More... | |
Public Member Functions | |
Page | RenderSinglePage (string markdownSource, double width, out Dictionary< string, string > linkDestinations) |
Parses the supplied markdownSource using all the supported extensions and renders the resulting document. Page breaks are disabled, and the document is rendered as a single page with the specified width . The page will be cropped at the appropriate height to contain the entire document. More... | |
Page | RenderSinglePage (MarkdownDocument markdownDocument, double width, out Dictionary< string, string > linkDestinations) |
Renders the supplied markdownDocument . Page breaks are disabled, and the document is rendered as a single page with the specified width . The page will be cropped at the appropriate height to contain the entire document. More... | |
Document | Render (string markdownSource, out Dictionary< string, string > linkDestinations) |
Parses the supplied markdownSource using all the supported extensions and renders the resulting document. The Document produced consists of one or more pages of the size specified in the PageSize of the current instance. More... | |
Document | Render (MarkdownDocument mardownDocument, out Dictionary< string, string > linkDestinations) |
Renders the supplied mardownDocument . The Document produced consists of one or more pages of the size specified in the PageSize of the current instance. More... | |
Properties | |
double | BaseFontSize = 9.71424 [get, set] |
The base font size to use when rendering the document. This will be the size of regular elements, and the size of header elements will be expressed as a multiple of this. More... | |
double | MathFontScalingFactor = 0.85 [get, set] |
Scaling factor for the font size to use when rendering math. More... | |
double[] | HeaderFontSizeMultipliers [get] |
The font size for elements at each header level. The values in this array will be multiplied by the BaseFontSize. More... | |
double[] | HeaderLineThicknesses = new double[] { 1, 1, 0, 0, 0, 0 } [get] |
The thickness of the separator line after a header of each level. A value of 0 disables the line after headers of that level. More... | |
double | ThematicBreakThickness = 2 [get, set] |
The thickness of thematic break lines. More... | |
FontFamily | RegularFontFamily = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Helvetica) [get, set] |
The font family for regular text. More... | |
FontFamily | BoldFontFamily = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.HelveticaBold) [get, set] |
The font family for bold text. More... | |
FontFamily | ItalicFontFamily = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.HelveticaOblique) [get, set] |
The font family for italic text. More... | |
FontFamily | BoldItalicFontFamily = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.HelveticaBoldOblique) [get, set] |
The font family for bold italic text. More... | |
FontFamily | CodeFont = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.Courier) [get, set] |
The font family for code elements. More... | |
FontFamily | CodeFontBold = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.CourierBold) [get, set] |
The font family for bold code elements. More... | |
FontFamily | CodeFontItalic = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.CourierOblique) [get, set] |
The font family for italic code elements. More... | |
FontFamily | CodeFontBoldItalic = FontFamily.ResolveFontFamily(FontFamily.StandardFontFamilies.CourierBoldOblique) [get, set] |
The font family for bold italic code elements. More... | |
double | UnderlineThickness = 0.075 [get, set] |
The thickness of underlines. This value will be multiplied by the font size of the element being underlined. More... | |
double | BoldUnderlineThickness = 0.15 [get, set] |
The thickness of underlines for bold text. This value will be multiplied by the font size of the element being underlined. More... | |
Margins | Margins = new Margins(55, 55, 55, 55) [get, set] |
The margins of the page. More... | |
Margins | TableCellMargins = new Margins(5, 0, 5, 0) [get, set] |
The margins for table cells. More... | |
VerticalAlignment | TableVAlign = VerticalAlignment.Middle [get, set] |
The vertical alignment of table cells. More... | |
Size | PageSize = new Size(595, 842) [get, set] |
The size of the page. More... | |
double | SpaceBeforeParagaph = 0 [get, set] |
The space before each text paragraph. This value will be multiplied by the BaseFontSize. More... | |
double | SpaceAfterParagraph = 0.75 [get, set] |
The space after each text paragraph. This value will be multiplied by the BaseFontSize. More... | |
double | SpaceAfterLine = 0.25 [get, set] |
The space after each line of text. This value will be multiplied by the BaseFontSize. More... | |
double | SpaceBeforeHeading = 0.25 [get, set] |
The space before each heading. This value will be multiplied by the font size of the heading. More... | |
double | SpaceAfterHeading = 0.25 [get, set] |
The space after each heading. This value will be multiplied by the font size of the heading. More... | |
double | CodeInlineMargin = 0.25 [get, set] |
The margin at the left and right of code inlines. This value will be multiplied by the current font size. More... | |
double | IndentWidth = 40 [get, set] |
The indentation width used for list items. More... | |
double | QuoteBlockIndentWidth = 30 [get, set] |
The indentation width used for block quotes. More... | |
double | QuoteBlockBarWidth = 5 [get, set] |
The thickness of the bar to the left of block quotes. More... | |
double | SubSuperscriptFontSize = 0.7 [get, set] |
The font size for subscripts and superscripts. This value will be multiplied by the current font size. More... | |
double | SuperscriptShift = 0.33 [get, set] |
The upwards shift in the baseline for superscript elements. This value will be multiplied by the current font size. More... | |
double | SubscriptShift = 0.14 [get, set] |
The downwards shift in the baseline for subscript elements. This value will be multiplied by the current font size. More... | |
string | BaseImageUri = "" [get, set] |
The base uri for resolving relative image addresses. More... | |
Func< string, string,(string, bool)> | ImageUriResolver = HTTPUtils.ResolveImageURI [get, set] |
A method used to resolve (possibly remote) image uris into local file paths. The first argument of the method should be the image uri and the second argument the base uri used to resolve relative links. The method should return a tuple containing the path of the local file and a boolean value indicating whether the file has been fetched from a remote location and should be deleted after the program has finished using it. More... | |
Uri | BaseLinkUri = new Uri("about:blank") [get, set] |
The base uri for resolving links. More... | |
Func< string, string > | LinkUriResolver = a => a [get, set] |
A method used to resolve link addresses. The argument of the method should be the absolute link, and the method should return the resolved address. This can be used to "redirect" links to a different target. More... | |
Func< string, RasterImage > | RasterImageLoader = null [get, set] |
A method used to a load raster image from a local file. The argument of the method should be the path of a local image file, and the method should return a RasterImage representing that file. For example, this can be achieved using the RasterImageFile class from the VectSharp.MuPDFUtils package. If this is null , only SVG images will be included in the document. More... | |
double | ImageUnitMultiplier = 0.60714 [get, set] |
The size of images (as defined in the image's width and height attributes) will be multiplied by this value to determine the actual size of the image on the page. This has no effect on images without a width or height attribute. More... | |
double | ImageMultiplier = 1 [get, set] |
The size of images will be multiplied by this value to determine the actual size of the image on the page. For images that have a width or height attribute, this will be applied in addition to the ImageUnitMultiplier. For images without width and height, only this multiplier will be applied. More... | |
double | ImageSideMargin = 10 [get, set] |
The margin on the right of left-aligned images and on the left of right-aligned images. More... | |
double | ImageMarginTolerance = 25 [get, set] |
Images will be allowed to extend into the page bottom margin area by this amount before triggering a page break. This should be smaller than the bottom margin, otherwise images risk being cut off by the page boundary. More... | |
Func< string, string, List< List< FormattedString > > > | SyntaxHighlighter = VectSharp.Markdown.SyntaxHighlighter.GetSyntaxHighlightedLines [get, set] |
A method used for syntax highlighting. The first argument should be the source code to highlight, while the second parameter is the name of the language to use for the highlight. The method should return a list of lists of FormattedStrings, with each list of FormattedStrings representing a line. For each code block, if the method returns null , no syntax highlighting is used. More... | |
List< Action< Graphics, Colour > > | Bullets [get] |
Bullet points used for unordered lists. Each element of this list corresponds to the bullet for each level of list indentation. If the list indentation is greater than the number of elements in this list, the bullet points will be reused cyclically. Each element of this list is a method taking two arguments: the first is the Graphics object on which the bullet point should be drawn, while the second is the colour in which it should be painted. The method should draw the bullet point centered around the origin. The size of the bullet point will be multiplied by the current font size. More... | |
Colour | ForegroundColour = Colours.Black [get, set] |
The foreground colour for text elements. More... | |
Colour | BackgroundColour = Colours.White [get, set] |
The background colour for the page. More... | |
Colour | HeaderLineColour = Colour.FromRgb(180, 180, 180) [get, set] |
The colour of the line below headers. More... | |
Colour | ThematicBreakLineColour = Colour.FromRgb(180, 180, 200) [get, set] |
The colour for thematic break lines. More... | |
Colour | LinkColour = Colour.FromRgb(25, 140, 191) [get, set] |
The colour for hypertext links- More... | |
Colour | CodeInlineBackgroundColour = Colour.FromRgb(240, 240, 240) [get, set] |
The background colour for code inlines. More... | |
Colour | CodeBlockBackgroundColour = Colour.FromRgb(240, 240, 245) [get, set] |
The background colour for code blocks. More... | |
Colour | QuoteBlockBarColour = Colour.FromRgb(75, 152, 220) [get, set] |
The colour for the bar to the left of block quotes. More... | |
Colour | QuoteBlockBackgroundColour = Colour.FromRgb(240, 240, 255) [get, set] |
The background colour for block quotes. More... | |
Colour | InsertedColour = Colour.FromRgb(0, 158, 115) [get, set] |
The colour for text that has been styled as "inserted". More... | |
Colour | MarkedColour = Colour.FromRgb(213, 94, 0) [get, set] |
The colour for text that has been styled as "marked". More... | |
Colour | TableHeaderRowSeparatorColour = Colours.Black [get, set] |
The colour for the line separating the table header row from normal rows. More... | |
Colour | TableRowSeparatorColour = Colour.FromRgb(180, 180, 180) [get, set] |
The colour for lines separating table rows from each other. More... | |
double | TableHeaderRowSeparatorThickness = 2 [get, set] |
The thickness of the line separating the table header row from normal rows. More... | |
double | TableHeaderSeparatorThickness = 1 [get, set] |
The thickness of lines separating table rows from each other. More... | |
Graphics | TaskListUncheckedBullet [get, set] |
The bullet used for unchecked task list items. More... | |
Graphics | TaskListCheckedBullet [get, set] |
The bullet used for checked task list items. More... | |
bool | AllowPageBreak = true [get, set] |
Determines whether page breaks should be treated as such in the source. More... | |
Renders Markdown documents into VectSharp graphics objects.
Definition at line 37 of file MarkdownRenderer.cs.
Defines the options for the vertical alignment of table cells.
Definition at line 130 of file MarkdownRenderer.cs.
Document VectSharp.Markdown.MarkdownRenderer.Render | ( | MarkdownDocument | mardownDocument, |
out Dictionary< string, string > | linkDestinations | ||
) |
Renders the supplied mardownDocument . The Document produced consists of one or more pages of the size specified in the PageSize of the current instance.
mardownDocument | The markdown document to render. |
linkDestinations | When this method returns, this value will contain a dictionary used to associate graphic action tags to hyperlinks. This can be used to enable such links when rendering the Document to a file. |
Definition at line 504 of file MarkdownRenderer.cs.
Document VectSharp.Markdown.MarkdownRenderer.Render | ( | string | markdownSource, |
out Dictionary< string, string > | linkDestinations | ||
) |
Parses the supplied markdownSource using all the supported extensions and renders the resulting document. The Document produced consists of one or more pages of the size specified in the PageSize of the current instance.
markdownSource | The markdown source to parse. |
linkDestinations | When this method returns, this value will contain a dictionary used to associate graphic action tags to hyperlinks. This can be used to enable such links when rendering the Document to a file. |
Definition at line 491 of file MarkdownRenderer.cs.
Page VectSharp.Markdown.MarkdownRenderer.RenderSinglePage | ( | MarkdownDocument | markdownDocument, |
double | width, | ||
out Dictionary< string, string > | linkDestinations | ||
) |
Renders the supplied markdownDocument . Page breaks are disabled, and the document is rendered as a single page with the specified width . The page will be cropped at the appropriate height to contain the entire document.
markdownDocument | The markdown document to render. |
width | The width of the page. |
linkDestinations | When this method returns, this value will contain a dictionary used to associate graphic action tags to hyperlinks. This can be used to enable such links when rendering the Page to a file. |
Definition at line 432 of file MarkdownRenderer.cs.
Page VectSharp.Markdown.MarkdownRenderer.RenderSinglePage | ( | string | markdownSource, |
double | width, | ||
out Dictionary< string, string > | linkDestinations | ||
) |
Parses the supplied markdownSource using all the supported extensions and renders the resulting document. Page breaks are disabled, and the document is rendered as a single page with the specified width . The page will be cropped at the appropriate height to contain the entire document.
markdownSource | The markdown source to parse. |
width | The width of the page. |
linkDestinations | When this method returns, this value will contain a dictionary used to associate graphic action tags to hyperlinks. This can be used to enable such links when rendering the Page to a file. |
Definition at line 418 of file MarkdownRenderer.cs.
|
getset |
Determines whether page breaks should be treated as such in the source.
Definition at line 402 of file MarkdownRenderer.cs.
|
getset |
The background colour for the page.
Definition at line 298 of file MarkdownRenderer.cs.
|
getset |
The base font size to use when rendering the document. This will be the size of regular elements, and the size of header elements will be expressed as a multiple of this.
Definition at line 42 of file MarkdownRenderer.cs.
|
getset |
The base uri for resolving relative image addresses.
Definition at line 221 of file MarkdownRenderer.cs.
|
getset |
The base uri for resolving links.
Definition at line 231 of file MarkdownRenderer.cs.
|
getset |
The font family for bold text.
Definition at line 75 of file MarkdownRenderer.cs.
|
getset |
The font family for bold italic text.
Definition at line 85 of file MarkdownRenderer.cs.
|
getset |
The thickness of underlines for bold text. This value will be multiplied by the font size of the element being underlined.
Definition at line 115 of file MarkdownRenderer.cs.
Bullet points used for unordered lists. Each element of this list corresponds to the bullet for each level of list indentation. If the list indentation is greater than the number of elements in this list, the bullet points will be reused cyclically. Each element of this list is a method taking two arguments: the first is the Graphics object on which the bullet point should be drawn, while the second is the colour in which it should be painted. The method should draw the bullet point centered around the origin. The size of the bullet point will be multiplied by the current font size.
Definition at line 272 of file MarkdownRenderer.cs.
|
getset |
The background colour for code blocks.
Definition at line 323 of file MarkdownRenderer.cs.
|
getset |
The font family for code elements.
Definition at line 90 of file MarkdownRenderer.cs.
|
getset |
The font family for bold code elements.
Definition at line 95 of file MarkdownRenderer.cs.
|
getset |
The font family for bold italic code elements.
Definition at line 105 of file MarkdownRenderer.cs.
|
getset |
The font family for italic code elements.
Definition at line 100 of file MarkdownRenderer.cs.
|
getset |
The background colour for code inlines.
Definition at line 318 of file MarkdownRenderer.cs.
|
getset |
The margin at the left and right of code inlines. This value will be multiplied by the current font size.
Definition at line 186 of file MarkdownRenderer.cs.
|
getset |
The foreground colour for text elements.
Definition at line 293 of file MarkdownRenderer.cs.
|
get |
The font size for elements at each header level. The values in this array will be multiplied by the BaseFontSize.
Definition at line 52 of file MarkdownRenderer.cs.
|
getset |
The colour of the line below headers.
Definition at line 303 of file MarkdownRenderer.cs.
|
get |
The thickness of the separator line after a header of each level. A value of 0 disables the line after headers of that level.
Definition at line 60 of file MarkdownRenderer.cs.
|
getset |
Images will be allowed to extend into the page bottom margin area by this amount before triggering a page break. This should be smaller than the bottom margin, otherwise images risk being cut off by the page boundary.
Definition at line 261 of file MarkdownRenderer.cs.
|
getset |
The size of images will be multiplied by this value to determine the actual size of the image on the page. For images that have a width or height attribute, this will be applied in addition to the ImageUnitMultiplier. For images without width and height, only this multiplier will be applied.
Definition at line 251 of file MarkdownRenderer.cs.
|
getset |
The margin on the right of left-aligned images and on the left of right-aligned images.
Definition at line 256 of file MarkdownRenderer.cs.
|
getset |
The size of images (as defined in the image's width and height attributes) will be multiplied by this value to determine the actual size of the image on the page. This has no effect on images without a width or height attribute.
Definition at line 246 of file MarkdownRenderer.cs.
|
getset |
A method used to resolve (possibly remote) image uris into local file paths. The first argument of the method should be the image uri and the second argument the base uri used to resolve relative links. The method should return a tuple containing the path of the local file and a boolean value indicating whether the file has been fetched from a remote location and should be deleted after the program has finished using it.
Definition at line 226 of file MarkdownRenderer.cs.
|
getset |
The indentation width used for list items.
Definition at line 191 of file MarkdownRenderer.cs.
|
getset |
The colour for text that has been styled as "inserted".
Definition at line 338 of file MarkdownRenderer.cs.
|
getset |
The font family for italic text.
Definition at line 80 of file MarkdownRenderer.cs.
|
getset |
The colour for hypertext links-
Definition at line 313 of file MarkdownRenderer.cs.
|
getset |
A method used to resolve link addresses. The argument of the method should be the absolute link, and the method should return the resolved address. This can be used to "redirect" links to a different target.
Definition at line 236 of file MarkdownRenderer.cs.
The margins of the page.
Definition at line 120 of file MarkdownRenderer.cs.
|
getset |
The colour for text that has been styled as "marked".
Definition at line 343 of file MarkdownRenderer.cs.
|
getset |
Scaling factor for the font size to use when rendering math.
Definition at line 47 of file MarkdownRenderer.cs.
The size of the page.
Definition at line 156 of file MarkdownRenderer.cs.
|
getset |
The background colour for block quotes.
Definition at line 333 of file MarkdownRenderer.cs.
|
getset |
The colour for the bar to the left of block quotes.
Definition at line 328 of file MarkdownRenderer.cs.
|
getset |
The thickness of the bar to the left of block quotes.
Definition at line 201 of file MarkdownRenderer.cs.
|
getset |
The indentation width used for block quotes.
Definition at line 196 of file MarkdownRenderer.cs.
|
getset |
A method used to a load raster image from a local file. The argument of the method should be the path of a local image file, and the method should return a RasterImage representing that file. For example, this can be achieved using the RasterImageFile
class from the VectSharp.MuPDFUtils
package. If this is null
, only SVG images will be included in the document.
Definition at line 241 of file MarkdownRenderer.cs.
|
getset |
The font family for regular text.
Definition at line 70 of file MarkdownRenderer.cs.
|
getset |
The space after each heading. This value will be multiplied by the font size of the heading.
Definition at line 181 of file MarkdownRenderer.cs.
|
getset |
The space after each line of text. This value will be multiplied by the BaseFontSize.
Definition at line 171 of file MarkdownRenderer.cs.
|
getset |
The space after each text paragraph. This value will be multiplied by the BaseFontSize.
Definition at line 166 of file MarkdownRenderer.cs.
|
getset |
The space before each heading. This value will be multiplied by the font size of the heading.
Definition at line 176 of file MarkdownRenderer.cs.
|
getset |
The space before each text paragraph. This value will be multiplied by the BaseFontSize.
Definition at line 161 of file MarkdownRenderer.cs.
|
getset |
The downwards shift in the baseline for subscript elements. This value will be multiplied by the current font size.
Definition at line 216 of file MarkdownRenderer.cs.
|
getset |
The font size for subscripts and superscripts. This value will be multiplied by the current font size.
Definition at line 206 of file MarkdownRenderer.cs.
|
getset |
The upwards shift in the baseline for superscript elements. This value will be multiplied by the current font size.
Definition at line 211 of file MarkdownRenderer.cs.
|
getset |
A method used for syntax highlighting. The first argument should be the source code to highlight, while the second parameter is the name of the language to use for the highlight. The method should return a list of lists of FormattedStrings, with each list of FormattedStrings representing a line. For each code block, if the method returns null
, no syntax highlighting is used.
Definition at line 266 of file MarkdownRenderer.cs.
The margins for table cells.
Definition at line 125 of file MarkdownRenderer.cs.
|
getset |
The colour for the line separating the table header row from normal rows.
Definition at line 348 of file MarkdownRenderer.cs.
|
getset |
The thickness of the line separating the table header row from normal rows.
Definition at line 358 of file MarkdownRenderer.cs.
|
getset |
The thickness of lines separating table rows from each other.
Definition at line 363 of file MarkdownRenderer.cs.
|
getset |
The colour for lines separating table rows from each other.
Definition at line 353 of file MarkdownRenderer.cs.
|
getset |
The vertical alignment of table cells.
Definition at line 151 of file MarkdownRenderer.cs.
|
getset |
The bullet used for checked task list items.
Definition at line 383 of file MarkdownRenderer.cs.
|
getset |
The bullet used for unchecked task list items.
Definition at line 368 of file MarkdownRenderer.cs.
|
getset |
The colour for thematic break lines.
Definition at line 308 of file MarkdownRenderer.cs.
|
getset |
The thickness of thematic break lines.
Definition at line 65 of file MarkdownRenderer.cs.
|
getset |
The thickness of underlines. This value will be multiplied by the font size of the element being underlined.
Definition at line 110 of file MarkdownRenderer.cs.