New-KFPDF
Syntax
New-KFPDF
-HTML <string>
[-AsStream[:$false]]
[-ThrowErrors[:$true]]
Support
>= kenaflow 1.0.0
Return
System.IO.Stream or System.Byte array.
Description
One of the great advantages of kenaflow is the integrated PDF engine, which, together with the template engine, makes it very easy to generate a PDF from simple HTML and the data from the workflow or item.
We use the open source software Chromium Embedded Framework and the .NET port "CEFSharp" to provide this functionality.
The example below shows how to create a PDF document from a template and upload it to SharePoint.
Parameters
-HTML <string>
The HTML string that gets converted to PDF.
[-AsStream[:$false]]
Tells the engine to return a System.IO.Stream object rather than a System.Byte array. Default (if not specified): System.Byte array.
[-ThrowErrors[:$true]]
This is a default parameter for all kenaflow cmdlets. If set to
$true
(default!) the engine will pass exception within the cmdlet to the script for further handling.
Example
$Text = (Invoke-KFTemplate -Template "<p>Hello <b>{{Author}}</b>.</p>")
$Pdf = New-KFPDF -HTML $Text -AsStream
Add-PnPFile -Folder "/Archive" -FileName "$($item.ID).pdf" -Stream $Pdf