<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PowerShell.nu &#187; PDF</title>
	<atom:link href="http://www.powershell.nu/tag/pdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powershell.nu</link>
	<description></description>
	<lastBuildDate>Wed, 14 Jul 2010 22:17:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Scripting PDF Documents through PowerShell</title>
		<link>http://www.powershell.nu/2009/09/08/scripting-pdf-documents-through-powershell/</link>
		<comments>http://www.powershell.nu/2009/09/08/scripting-pdf-documents-through-powershell/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 11:06:00 +0000</pubDate>
		<dc:creator>Niklas Goude</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.powershell.nu/?p=801</guid>
		<description><![CDATA[Microsoft Office Supports Scripting possibilities through Com Objects. But what about PDF Documents ? Luckily there is a DLL available for download that let&#8217;s us Create PDF documents through .NET First you have to Download the ITextSHarp.dll Next, Time for some PowerShell Magic. Step One: Load the DLL. PS > [System.Reflection.Assembly]::LoadFrom("C:\itextsharp\itextsharp.dll") Step Two: Create a [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Office Supports Scripting possibilities through Com Objects. But what about PDF Documents ? Luckily there is a DLL available for download that let&#8217;s us Create PDF documents through .NET</p>
<p />
First you have to <a href="http://sourceforge.net/projects/itextsharp/">Download the ITextSHarp.dll</a></p>
<p />
Next, Time for some PowerShell Magic.</p>
<p />
<strong>Step One:</strong> Load the DLL.</p>
<p />
<pre>
<strong>
PS > [System.Reflection.Assembly]::LoadFrom("C:\itextsharp\itextsharp.dll")
</strong>
</pre>
<p><strong>Step Two:</strong> Create a Variable holding the iTextSharp.text.Document Object</p>
<p />
<pre>
<strong>
PS > $Doc = New-Object iTextSharp.text.Document
</strong>
</pre>
<p />
<strong>Step Three:</strong> Create a PDF Document with a connection to the $Doc variable</p>
<p />
<pre>
<strong>
PS > [void][iTextSharp.text.pdf.PdfWriter]::GetInstance($Doc, [System.IO.File]::Create("C:\PDF\Goude.pdf") )
</strong>
</pre>
<p />
<strong>Step Four:</strong> Open The Document ( In order to add information to the PDF File )</p>
<p />
<pre>
<strong>
PS > $Doc.Open()
</strong>
</pre>
<p />
<strong>Step Five:</strong> Create a Text Chunk and append Text to Display in Pdf Document</p>
<p />
<pre>
<strong>
PS > $Chunk = New-Object iTextSharp.text.Chunk
PS > [void]$Chunk.Append(“Demo From PowerShell.nu”)
</strong>
</pre>
<p />
<strong>Step Six:</strong> Add the Chunk of Text, Set an Author with the AddAuthor() method and finally Close it with the Close() method</p>
<p />
<pre>
<strong>
PS > $Doc.Add($Chunk)
PS > $Doc.AddAuthor("Niklas Goude")
PS > $Doc.Close()
</strong>
</pre>
<p />
Voila, you now have a PowerShell made PDF File. You can, of course, create far more advanced PDF files containing tons of information. I&#8217;ll get back to this in a later Post.</p>
<p />
]]></content:encoded>
			<wfw:commentRss>http://www.powershell.nu/2009/09/08/scripting-pdf-documents-through-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
