0
votes

How do I add an image to a PDF document I am creating via PowerShell?

I am adding text with code like:

$environmentElem = New-Object iTextSharp.text.Paragraph;
[void]$environmentElem.Add("Text");
[void]$TemplateDoc.Add($environmentElem);

I have tried in PowerShell to walk down the namespace looking for a suitable type (iTextSharp.text.Image) but to no avail.

Also I need to do a lot of PDF creation through PS using iTextSharp, is there a good resource you can recommend?

Thanks, Andrew

1

1 Answers

0
votes

try this, I've not tested but convert from c# take from here:

$jpg = [iTextSharp.text.Image]::GetInstance( "c:\path\to\your\file.JPG" )
$TemplateDoc.Add($jpg);