How can I add images to a PDF created with Nreco PdfGenrator

Mar*_*kus 3 powershell pdf-generation

I'm using Nreco PDFGenerator to generate PDFs using the following PowerShell script:

$PdfGenerator = "$((Get-Location).Path)\lib\NReco.PdfGenerator.dll"
$Assembly = [Reflection.Assembly]::LoadFrom($PdfGenerator)
$PdfCreator = New-Object NReco.PdfGenerator.HtmlToPdfConverter

$PdfCreator.PageHeight = 297
$PdfCreator.PageWidth = 210
$PdfCreator.Zoom = 2
$pdfBytes = $PdfCreator.GeneratePdf([string](gc myhtml.htm))
Add-Content -Value $pdfBytes -Encoding byte -Path "./mypdf.pdf"
Run Code Online (Sandbox Code Playgroud)

myhtml.htm is a simple HTML document:

<html>
  <head>
    <title>Hello World</title>
  <body>
    <img src='./img/FancyImage.jpg' alt='Fancy Image' />
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

Everything looks perfectly fine, except that the images are missing...

Any ideas are welcome!

Mar*_*kus 5

显然,答案在项目网站/常见问题解答上是正确的:

可以通过指定图像的完整 URL 或路径(如果它们在本地文件系统上)来包含图像。还支持外部 CSS 和 javascript 文件。