【发布时间】:2025-12-06 14:35:01
【问题描述】:
我正在使用Nreco PDFGenerator 使用以下 PowerShell 脚本生成 PDF:
$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 是一个简单的 HTML 文档:
<html>
<head>
<title>Hello World</title>
<body>
<img src='./img/FancyImage.jpg' alt='Fancy Image' />
</body>
</html>
一切看起来都很好,只是图像丢失了......
欢迎提出任何想法!
【问题讨论】: