This Specification Flow Task will create a new PDF document from a Markdown file (.md) styled using a CSS file.
Property Name | Description |
---|---|
Title | Changes the Title (not the name) of the task. |
Markdown File | File path to the Markdown (.md) file to convert to PDF.
Relative paths are resolved to the Specification directory. Accepted prefixes: <Project>, <Specification>, <SpecificationMetadata>, <GroupContent> The Text Document can be used to help create a dynamic, rules based, Specification specific, markdown file. See Markdown File Syntax below to learn how to construct a Markdown file. |
Style Sheet File | File path to the CSS (.css) file to style the provided Markdown content.
Relative paths are resolved to the Specification directory. Accepted prefixes: <Project>, <Specification>, <SpecificationMetadata>, <GroupContent> The style sheet is used to style the data in the markdown file. This includes defining layout, color and fonts. This is a required value but can reference an empty .css file, this will result in defaulting to the system settings it is created on. We do not recommended using an empty .css file as there is less control over the output. See Style Sheet File Example below for an example of a CSS file. |
PDF File | The file path to save the generated PDF.
Relative paths are resolved to the Specification directory. Accepted prefixes: <Project>, <Specification>, <SpecificationMetadata>, <GroupContent> An existing directory is required to save the PDF. If the path specified does not exist the Task will fail. To create a folder to save the PDF file consider using the Copy Folder Task, immediately before this task. If this property evaluates an existing file, it will be overwritten. |
Page Size | Specifies the size for the pages in the generated PDF.
Defaults to A4. One of: A0, A1, A2, A3, A4, A5, A6, B4, PageLegal, PageLedger, PageLetter. |
Is Portrait | Specifies the orientation of the pages in the generated PDF.
True, (the default) means the pages will be in portrait orientation. False means the pages will be in landscape orientation. |
This Task has been created and tested using Markdown that follows the CommonMark Specification.
This website is also a great resource to learn Markdown.
When this Task is added the properties are static. To be able to build rules on a static property see How To: Change A Static Property To A Dynamic Property.
Property Name | Example Rule | Meaning |
---|---|---|
Markdown File | "Markdown" & DWSpecification & ".md" | The task will use the markdown data inside the Markdown9999.md file located in the Specification folder. |
Style Sheet File | "DocumentStyle.css" | The Markdown data will be styled using DocumentStyle.css stored relative to the Markdown file being driven. |
PDF File | "C:\DriveWorksData\Specifications\9999\SpecificationData.pdf" | The task will save the generated SpecificationData.pdf inside the 9999\SpecificationData folder. |
Page Size | PageLegal | The generated PDF pages will be Legal US paper size. 215.9 x 355.6 (mm). 8.5 x 14 (inches). |
Is Portrait | FALSE | The generated PDF pages will be in landscape orientation. |
Markdown | Example | Result |
---|---|---|
# | # My Top Level Heading | My Top Level Heading |
## | ## My Second Level Heading | My Second Level Heading |
### | ### My Third Level Heading | My Third Level Heading |
Markdown | Example | Result |
---|---|---|
*_* | *Italic* | Italic |
**_** | **Bold** | Bold |
Markdown | Example | Result |
---|---|---|
[name](url) | [DriveWorks](https://www.driveworks.co.uk/) | DriveWorks |
Markdown | Example | Result |
---|---|---|
- - - | - Line one - Line two - Line three |
|
1. 2. 3. | 1. Line one 2. Line two 3. Line three |
|
Local Images Relative To The Markdown File
The simplest method of including images in the Markdown File is to reference them from the same location as the Markdown file.
The Copy File Task can be used to move or copy any image to this location.
Remove any spaces used in the name of the image.
If this is not possible replace the space with %20 in the Markdown file.
Markdown | Example | Result |
---|---|---|
![AltText](Image) | ![DriveWorks Logo](Logo.svg)
Image stored in the same location is the Markdown file. | |
![AltText](Image) | ![DriveWorks Logo](Images/Logo.svg)
Image stored in a sub folder to the Markdown file. |
Local Images Located Away From The Markdown File
Local images are required to have the full file path converted to a universal resource identifier (URI).
To convert a full file path to a URI:
For example: C:\ will become C:///
For example: DriveWorks\Markdown\Images will become DriveWorks/Markdown/Images
For example: Pdf Images/My Image.png will become Pdf%20Images/My%20Image.png
Markdown | Example | Result |
---|---|---|
![AltText](URI) | ![DriveWorks Logo](D:///DriveWorks/PDF%20Images/Logo.svg) |
To reference an image stored on the web use the full URL to the image.
Markdown | Example | Result |
---|---|---|
![AltText](URL) | ![DriveWorks Logo](https://www.driveworks.co.uk/Logo.svg) |
HTML tables can be used directly in markdown.
<table> <tbody> <tr> <th>Col1Heading</th> <th>Col2Heading</th> <th>Col3Heading</th> </tr> <tr> <td>Col1Data</td> <td>Col2Data</td> <td>Col3Data</td> </tr> </tbody> </table>
The following is an example of a CSS file that can be used to style the Markdown content.
Copy the contents below and paste into a text editor (Notepad).
Save the Notepad file to the location and name specified in the Style Sheet File property, with the extension .css.
/* Markdown Styling -------------------------------------------------*/ @page { background-color: #f3f4f6; } html { background-color: #ffffff; padding: 16px; } h1 { text-align: left; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 24px; } h2 { text-align: left; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 16px; } h3 { text-align: left; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 13px; break-before: always; } p { text-align: left; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } ul { list-style-type: square; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } ul li { text-align: left; padding: 6px; margin-left: 12px; } table { table-layout: fixed; width: 100%; margin-left: auto; margin-right: auto; border-collapse: collapse; background-color: #f9fafb; border: 1px solid #e5e7eb; font-family: Arial, Helvetica, sans-serif; } th, td { padding: 8px; border: 1px solid #e5e7eb;; } th { text-align: left; font-weight: bold; font-size: 12px; } td { word-wrap: break-word; font-size: 12px; } ol { list-style-type: lower-alpha; color: #1f2937; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } ol li { text-align: left; padding: 6px; margin-left: 12px; } img { display: block; margin-left: auto; margin-right: auto; width: 25%; } img[alt="localfile"] { width: 50%; } hr { color: #1f2937; } code { background-color: #374151; color: #cecece; }
The following fonts are unsupported for use in PDF documents:
This task has different types of Outputs. For more information about Outputs see Specification Macros Task Node.
Outputs are only available within Specification Macros. Currently Outputs are not available for Specification Flow.
This task supports Status Outputs. These can be used to perform different actions depending on what the status outcome of the task is. For more information see Status Outputs in the Task Node Outputs section of Specification Macros Task Node.
The status output navigation is as follows:
Success
Success with Warnings
Failed