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!
显然,答案在项目网站/常见问题解答上是正确的:
可以通过指定图像的完整 URL 或路径(如果它们在本地文件系统上)来包含图像。还支持外部 CSS 和 javascript 文件。
| 归档时间: |
|
| 查看次数: |
4913 次 |
| 最近记录: |