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"
myhtml.htm
is a simple HTML document:
<html>
<head>
<title>Hello World</title>
<body>
<img src='./img/FancyImage.jpg' alt='Fancy Image' />
</body>
</html>
Everything looks perfectly fine, except that the images are missing...
Any ideas are welcome!
Apperently, the answer was right on the projects website / FAQ:
It is possible to include images by specifying their FULL URL or path (if they're on local filesystem). External CSS and javascript files are also supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With