【发布时间】:2014-06-27 21:49:36
【问题描述】:
我正在尝试在 Powershell 中使用 itextsharp(如果这是更好的选择,可以更改为 pdfsharp)从图像中制作 PDF。我已经设法用一张图片创建了一个 PDF 文件,但我不知道如何从文件夹中的所有图片中创建一个。
由于这些图像的比例非常适合 PDF,因此我还想设置比例以使其 100% 填满页面。那可能吗?
我不是经验丰富的 Powershell 用户,但这是我目前所得到的:
[System.Reflection.Assembly]::LoadFrom("C:\temp\itextsharp.dll")
$doc = New-Object iTextSharp.text.Document
$fileStream = New-Object IO.FileStream("C:\temp\output5.pdf", [System.IO.FileMode]::Create)
[iTextSharp.text.pdf.PdfWriter]::GetInstance($doc, $filestream)
$jpg = [iTextSharp.text.Image]::GetInstance( "c:\temp\horse.jpg" )
$doc.open()
$Doc.add($jpg);
$doc.close()
如果有人知道,请告诉我,谢谢。
【问题讨论】:
标签: powershell pdf itextsharp