<?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>Wacdesigns</title>
	<atom:link href="http://www.wacdesigns.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wacdesigns.com</link>
	<description>What about Creativity ?</description>
	<lastBuildDate>Tue, 24 Apr 2012 08:09:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pets for sale with Google Analytics</title>
		<link>http://www.wacdesigns.com/2012/04/24/pets-for-sale-google-analytics/</link>
		<comments>http://www.wacdesigns.com/2012/04/24/pets-for-sale-google-analytics/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 08:06:35 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=413</guid>
		<description><![CDATA[Today while browsing Google Analytics, this funny tooltip appeared : &#160; Hover your mouse over the dot, the tooltip Pets for sale appears. Nice to have feature]]></description>
			<content:encoded><![CDATA[<p>Today while browsing Google Analytics, this funny tooltip appeared :</p>
<p><a href="http://www.wacdesigns.com/wp-content/uploads/2012/04/GoogleAnalytics-Pets_for_sale.jpg"><img class="alignnone size-full wp-image-416" title="Google Analytics Pets for sale" src="http://www.wacdesigns.com/wp-content/uploads/2012/04/GoogleAnalytics-Pets_for_sale.jpg" alt="Google Analytics Pets for sale" width="634" height="477" /></a></p>
<p>&nbsp;</p>
<p>Hover your mouse over the dot, the tooltip Pets for sale appears.</p>
<p>Nice to have feature <img src='http://www.wacdesigns.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2012/04/24/pets-for-sale-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is school for?</title>
		<link>http://www.wacdesigns.com/2012/02/27/school-for/</link>
		<comments>http://www.wacdesigns.com/2012/02/27/school-for/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 02:30:07 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[Bloggers]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Change]]></category>
		<category><![CDATA[Economy]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[Seth Godin]]></category>
		<category><![CDATA[Student]]></category>
		<category><![CDATA[Teachers]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=366</guid>
		<description><![CDATA[Quick post on this article by Seth Godin : Stop Stealing Dreams You can read the manifesto online here. &#160;]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://i1.squidoocdn.com/resize/squidoo_images/-1/lens19112751_fd01663294851de80fe18b6cc531d481.jpg" alt="" width="533" height="465" /></p>
<p>Quick post on this article by <a href="http://www.squidoo.com">Seth Godin</a> : <a title="Stop stealing dreams by Seth Godin" href="http://www.squidoo.com/stop-stealing-dreams">Stop Stealing Dreams</a></p>
<p>You can read the manifesto online <a href="http://www.sethgodin.com/sg/docs/StopStealingDreamsSCREEN.pdf">here</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2012/02/27/school-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Snapshot from D3100</title>
		<link>http://www.wacdesigns.com/2011/11/28/quick-snapshot-d3100/</link>
		<comments>http://www.wacdesigns.com/2011/11/28/quick-snapshot-d3100/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 16:38:35 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[Leisure]]></category>
		<category><![CDATA[My Life]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[D3100]]></category>
		<category><![CDATA[Mauritius]]></category>
		<category><![CDATA[Nikon]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=364</guid>
		<description><![CDATA[More photo available on my flickr set]]></description>
			<content:encoded><![CDATA[<p><a href="http://farm8.staticflickr.com/7158/6404483387_01fe6f3bd2_b.jpg" target="_blank"><img class="alignnone" title="Sunset at Mont Choisy - Mauritius" src="http://farm8.staticflickr.com/7158/6404483387_01fe6f3bd2_m.jpg" alt="" width="240" height="160" /></a><a href="http://farm7.staticflickr.com/6217/6404419755_4881cd81e0_b.jpg" target="_blank"> <img class="alignnone" title="Cloudy sunset sky" src="http://farm7.staticflickr.com/6217/6404419755_4881cd81e0_m.jpg" alt="" width="240" height="160" /></a><a href="http://farm8.staticflickr.com/7150/6404415511_049e6cc343_b.jpg"> <img class="alignnone" title="People running on the beach" src="http://farm8.staticflickr.com/7150/6404415511_049e6cc343_m.jpg" alt="" width="240" height="160" /></a></p>
<p>More photo available on my <a href="http://www.flickr.com/photos/jf_my_life/sets/72157628158154197/with/6404415511/" target="_blank">flickr set</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2011/11/28/quick-snapshot-d3100/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome to my new D3100</title>
		<link>http://www.wacdesigns.com/2011/11/20/d3100/</link>
		<comments>http://www.wacdesigns.com/2011/11/20/d3100/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 13:00:00 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[Leisure]]></category>
		<category><![CDATA[My Life]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[D3100]]></category>
		<category><![CDATA[Nikon]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=352</guid>
		<description><![CDATA[Finally decided and now owner of a Nikon D3100. Photos will be coming soon !!! But in the meanwhile check out my photos on Flickr]]></description>
			<content:encoded><![CDATA[<p>Finally decided and now owner of a Nikon D3100.</p>
<p><a href="http://www.wacdesigns.com/wp-content/uploads/2011/11/25472_D3100_front.png"><img class="alignnone size-medium wp-image-353" title="Nikon D3100" src="http://www.wacdesigns.com/wp-content/uploads/2011/11/25472_D3100_front-300x255.png" alt="Nikon D3100" width="300" height="255" /></a><br />
Photos will be coming soon !!!</p>
<p>But in the meanwhile check out my photos on <a title="FlickR" href="http://www.flickr.com/photos/jf_my_life/" target="_blank">Flickr</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2011/11/20/d3100/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic sql where in sql server</title>
		<link>http://www.wacdesigns.com/2011/06/20/dynamic-sql-where-in-sql-server/</link>
		<comments>http://www.wacdesigns.com/2011/06/20/dynamic-sql-where-in-sql-server/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 13:00:06 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Dynamic SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=312</guid>
		<description><![CDATA[I&#8217;ve been recently working a dynamic sql script launched from within a stored procedure that will generate a filter claused based on parameters passed. One the filter clause that i had to take into account was a &#8220;WHERE IN&#8221;, while passing something like &#8220;a,b,c&#8221; as parameter, it did not seem to work, so i went [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been recently working a dynamic sql script launched from within a stored procedure that will generate a filter claused based on parameters passed. One the filter clause that i had to take into account was a &#8220;WHERE IN&#8221;, while passing something like &#8220;a,b,c&#8221; as parameter, it did not seem to work, so i went a bit in depth and found out that there was some issues while using the <strong>WHERE IN</strong> clause in dynamic SQL.</p>
<p>The solution found to this problem is to transform the list in the parameter into a table form that can be used in the dynamic WHERE IN clause</p>
<pre>

DECLARE @ParamList NVARCHAR(max)

DECLARE @Query NVARCHAR(4000)

SET @ParamList = 'hello,this,is,a,list,of,param'

SET @Query = N'SELECT * FROM TableName WHERE ColumnName IN (SELECT param FROM iter_simple_charlist_to_tbl(@ParamList))'

exec sp_executesql @Query, N'@ParamList NVARCHAR(max)', @ParamList
</pre>
<p>&nbsp;</p>
<p>Below is the script for the Table-valued function to convert a given VARCHAR parameter list to table (A small variation is needed for integer type parameter list)</p>
<pre>
/****** Object: UserDefinedFunction [dbo].[iter_simple_charlist_to_tbl] Script Date: 06/17/2011 12:40:04 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[iter_simple_charlist_to_tbl]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[iter_simple_charlist_to_tbl]
GO
/****** Object: UserDefinedFunction [dbo].[iter_simple_charlist_to_tbl] Script Date: 06/17/2011 12:40:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[iter_simple_charlist_to_tbl] (@list nvarchar(MAX))
RETURNS @tbl TABLE (param nvarchar(50) NOT NULL) AS
BEGIN
DECLARE @pos int,
@nextpos int,
@valuelen int

SELECT @pos = 0, @nextpos = 1

WHILE @nextpos &gt; 0
BEGIN
SELECT @nextpos = charindex(',', @list, @pos + 1)
SELECT @valuelen = CASE WHEN @nextpos &gt; 0
THEN @nextpos
ELSE len(@list) + 1
END - @pos - 1
INSERT @tbl (param)
VALUES (substring(@list, @pos + 1, @valuelen))
SELECT @pos = @nextpos
END
RETURN
END
</pre>
<p>References of this implementation are:<br />
<a href="http://www.sommarskog.se/arrays-in-sql-2005.html#returnformat" rel="nofollow" target="_blank"> http://www.sommarskog.se/arrays-in-sql-2005.html#returnformat</a><br />
<a href="http://www.restfuldevelopment.net/david-kawliche/writing/dynamic-in-without-dynamic-sql/" rel="nofollow" target="_blank">http://www.restfuldevelopment.net/david-kawliche/writing/dynamic-in-without-dynamic-sql/</a></p>
<p>Note: This solution does not offer an performance optimization and can be inefficient in some scenarios.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2011/06/20/dynamic-sql-where-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Resx Editor</title>
		<link>http://www.wacdesigns.com/2011/01/04/simple-resx-editor/</link>
		<comments>http://www.wacdesigns.com/2011/01/04/simple-resx-editor/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 08:59:58 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Globalization]]></category>
		<category><![CDATA[RESX Editor]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=302</guid>
		<description><![CDATA[I recently came to a nice Resx Editor alternative. It&#8217;s simple to use and the learning curve is very low. It&#8217;s perfect for your staff that you don&#8217;t want to train in Visual Studio to edit Resx file to text translation. Take a look at it: http://simpleresxeditor.blogspot.com/2010/12/simple-resx-editor-0660-is-now.html There is also a video tutorial available: http://www.youtube.com/watch?v=7hUdkqVXmWc&#38;feature=player_embedded [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came to a nice Resx Editor alternative. It&#8217;s simple to use and the learning curve is very low. It&#8217;s perfect for your staff that you don&#8217;t want to train in Visual Studio to edit Resx file to text translation.</p>
<p>Take a look at it: <a href="http://simpleresxeditor.blogspot.com/2010/12/simple-resx-editor-0660-is-now.html" rel="nofollow" target="_blank">http://simpleresxeditor.blogspot.com/2010/12/simple-resx-editor-0660-is-now.html</a></p>
<p>There is also a video tutorial available: <a href="http://www.youtube.com/watch?v=7hUdkqVXmWc&amp;feature=player_embedded" rel="nofollow" target="_blank">http://www.youtube.com/watch?v=7hUdkqVXmWc&amp;feature=player_embedded</a></p>
<p>It features:</p>
<p>* Highlight differences and coincidences (1)</p>
<p>* Highlight keys containing text</p>
<p>* Show/Hide keys</p>
<p>* Filter text-only rows</p>
<p>* Drag and drop support</p>
<p>* Multi-language UI</p>
<p>(1) With multiple resx files loaded</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2011/01/04/simple-resx-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toggl &#8211; Time tracking that works</title>
		<link>http://www.wacdesigns.com/2010/11/02/toggl-time-tracking-that-works/</link>
		<comments>http://www.wacdesigns.com/2010/11/02/toggl-time-tracking-that-works/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 11:48:44 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[Cool Tools]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Time Tracking]]></category>
		<category><![CDATA[Toggl]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=300</guid>
		<description><![CDATA[Recently I&#8217;ve been searching for a Time Tracking/Management tool that will allow me to monitor and report the time that I have been working on my task/projects. While searching on the web i found Toggl, as mention on the website: Toggl is Time tracking that works. Get things done and turn your time into money. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been searching for a Time Tracking/Management tool that will allow me to monitor and report the time that I have been working on my task/projects. While searching on the web i found <a title="Toggl" href="http://www.toggl.com/" target="_blank">Toggl</a>, as mention on the website:</p>
<blockquote><p>Toggl is Time tracking that works. Get things done and turn your time into money. Track time with a single click, switch easily between different tasks and create reports.</p></blockquote>
<p>I have been using it for a few month now and it&#8217;s really worst a try, the free version offers nearly all functionality that a time tracker needs. It has a windows agent that allows you to track your time directly from your desktop without event connecting to the website. And most of all it&#8217;s compatible with all major platforms (Windows/Mac/Linux/Mobile) !!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2010/11/02/toggl-time-tracking-that-works/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CodeIgniter &#8211; Pagination SEO Issue</title>
		<link>http://www.wacdesigns.com/2010/10/15/codeigniter-pagination-seo-issue/</link>
		<comments>http://www.wacdesigns.com/2010/10/15/codeigniter-pagination-seo-issue/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 13:00:47 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[Pagination]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=287</guid>
		<description><![CDATA[I have recently been working with a PHP MVC Framework called CodeIgniter on a complete web application solution.  I have been trying some major framework like CakePHP, Zen and Symphony which where all very powerful framework for MVC and RAD development, the only thing they lack was a bit more of flexibility like CodeIgniter propose. [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been working with a PHP MVC Framework called <a title="CodeIgniter Website" href="http://codeigniter.com/" target="_blank">CodeIgniter </a>on a complete web application solution.  I have been trying some major framework like CakePHP, Zen and Symphony which where all very powerful framework for MVC and RAD development, the only thing they lack was a bit more of flexibility like CodeIgniter propose. Anyway may not have taken enought time to get to know all of the specifics of the other Frameworks, but while benchmarking i got aquainted to CodeIgniter much faster.</p>
<p>Even though CodeIgniter is a very flexible framework, it&#8217;s very lightweight and some feature for Web application have not been taken into account, that in mind, the people behind <a href="http://ellislab.com/" target="_blank">EllisLab, Inc</a> made sure that these small twigs were easily bypassed by allowing complete customization of their libraries.</p>
<p>Here is my original issue:</p>
<p>I have a item listing page with pagination activated and I wanted the first page to be the the root URL of the item page.<br />
e.g. http://www.mysite.com/items</p>
<p>But what CodeIgniter Pagination Library generated for the first page was: http://www.mysite.com/result/1</p>
<p>That is pretty inconvenient for SEO, because the crawler will find two pages with the same content while crawling the pages.</p>
<p>Thus i modified the CI_Pagination library an created MY_Pagination.</p>
<p>First of all i have added a new variable called first_page_url as class variable in MY_Pagination class</p>
<pre>

class MY_Pagination extends CI_Pagination {

var $first_page_url        = ''; // The first page will have this URL
</pre>
<p>I have changed the original Pagination Library First page rendering from</p>
<pre>

// Render the "First" link
if  ($this-&gt;cur_page &gt; ($this-&gt;num_links + 1))
{
$output .= $this-&gt;first_tag_open.'&lt;a href="'.$this-&gt;base_url.'"&gt;'.$this-&gt;first_link.'&lt;/a&gt;'.$this-&gt;first_tag_close;
}
</pre>
<p>to</p>
<pre>

// Render the "First" link
if  ($this-&gt;cur_page &gt; ($this-&gt;num_links + 1))
{
$output .= $this-&gt;first_tag_open.'&lt;a href="'.$this-&gt;first_page_url == '' ? $this-&gt;base_url : $this-&gt;first_page_url.'"&gt;'.$this-&gt;first_link.'&lt;/a&gt;'.$this-&gt;first_tag_close;
}
</pre>
<p>This way if during the initialization of the Pagination class the configuration setting first_page_url was passed it will be used instead of the base_url.</p>
<p>Some modification were also made to the pagination digit generation from</p>
<pre>

// Write the digit links
for ($loop = $start -1; $loop &lt;= $end; $loop++)
{
$i = ($loop * $this-&gt;per_page) - $this-&gt;per_page;

if ($i &gt;= 0)
{
if ($this-&gt;cur_page == $loop)
{
$output .= $this-&gt;cur_tag_open.$loop.$this-&gt;cur_tag_close; // Current page
}
else
{
$n = ($i == 0) ? '' : $i;
$output .= $this-&gt;num_tag_open.'&lt;a href="'.$this-&gt;base_url.$n.'"&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
}
}
}
</pre>
<p>to</p>
<pre>

// Write the digit links
for ($loop = $start -1; $loop &lt;= $end; $loop++)
{
$i = ($loop * $this-&gt;per_page) - $this-&gt;per_page;

if ($i &gt;= 0)
{
if ($this-&gt;cur_page == $loop)
{
$output .= $this-&gt;cur_tag_open.$loop.$this-&gt;cur_tag_close; // Current page
}
else if($loop == 1 &amp;&amp; $this-&gt;first_page_url != '')
{
$output .= $this-&gt;num_tag_open.'&lt;a href="'.$this-&gt;first_page_url.'"&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
}
else
{
$n = ($i == 0) ? '' : $i;
$output .= $this-&gt;num_tag_open.'&lt;a href="'.$this-&gt;base_url.$n.'"&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
}
}
}
</pre>
<p>which will make sure that the page numbered 1 takes has the first_page_url has href when  first_page_url is available.</p>
<p>The complete file can be found here: <a href="http://www.wacdesigns.com/wp-content/uploads/2010/10/MY_Pagination.zip">MY_Pagination</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2010/10/15/codeigniter-pagination-seo-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Been a while !!!</title>
		<link>http://www.wacdesigns.com/2010/10/13/been-a-while/</link>
		<comments>http://www.wacdesigns.com/2010/10/13/been-a-while/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 16:30:24 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[My Life]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/?p=283</guid>
		<description><![CDATA[It&#8217;s been a while since the last post on my blog. Since then there have been quiet some changes in my life and work, in mostly good ways. I&#8217;ve been working a lot on various aspect or our web platform at work, in terms of optimization, design and scalability. And i think this has help [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since the last post on my blog. Since then there have been quiet some changes in my life and work, in mostly good ways. I&#8217;ve been working a lot on various aspect or our web platform at work, in terms of optimization, design and scalability. And i think this has help me progress and learn a lot from the Web. I&#8217;ll try to post my learning as much as I can and contribute the maximum to help the web community.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2010/10/13/been-a-while/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Merge pdf files using C#</title>
		<link>http://www.wacdesigns.com/2008/10/03/merge-pdf-files-using-c/</link>
		<comments>http://www.wacdesigns.com/2008/10/03/merge-pdf-files-using-c/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 23:00:57 +0000</pubDate>
		<dc:creator>jf</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Merge]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.wacdesigns.com/2008/10/03/merge-pdf-files-using-c/</guid>
		<description><![CDATA[Recently I had to create an assembly component using C# to merge multiple PDF files into one file. The specification was pretty straight forward: 1) Merge two of more PDF document into a single output PDF File. 2) Used on an ASP.NET Page After a few minutes of GOOG, I came up to this &#8220;ITextSharp&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to create an assembly component using C# to merge multiple PDF files into one file. The specification was pretty straight forward:<br />
1) Merge two of more PDF document into a single output PDF File.<br />
2) Used on an ASP.NET Page</p>
<p>After a few minutes of GOOG, I came up to this &#8220;<a title="ITextSharp" href="http://sourceforge.net/projects/itextsharp/" target="_blank">ITextSharp</a>&#8221;</p>
<blockquote><p>iText# (iTextSharp) is a port of the iText open source java library written entirely in C# for the .NET platform. iText# is a library that allows you to generate PDF files on the fly. It is implemented as an assembly.</p></blockquote>
<p><em>It must be noted that the assembly is coded and compiled using the .NET Framework 1.1. You might want to migrate to the version 2.0 or 3.5 of the .NET Framework. </em></p>
<p>With a some more research on PDF merging. I was able to create a class that will make use of the ITextSharp assembly and perform as the merge pdf operation as needed.</p>
<p>Here is the code:</p>
<pre>using iTextSharp.text;
using iTextSharp.text.pdf;

public class MergeEx
{
#region Fields
private string sourcefolder;
private string destinationfile;
private IList fileList = new ArrayList();
#endregion

#region Public Methods
///
/// Add a new file, together with a given docname to the fileList and namelist collection
///
public void AddFile(string pathnname)
{
fileList.Add(pathnname);
}

///
/// Generate the merged PDF
///
public void Execute()
{
MergeDocs();
}
#endregion

#region Private Methods
///
/// Merges the Docs and renders the destinationFile
///
private void MergeDocs()
{

//Step 1: Create a Docuement-Object
Document document = new Document();
try
{
//Step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destinationfile, FileMode.Create));

//Step 3: Open the document
document.Open();

PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;

int n = 0;
int rotation = 0;

//Loops for each file that has been listed
foreach (string filename in fileList)
{
//The current file path
string filePath = sourcefolder + filename;

// we create a reader for the document
PdfReader reader = new PdfReader(filePath);

//Gets the number of pages to process
n = reader.NumberOfPages;

int i = 0;
while (i &lt; n)
{
i++;
document.SetPageSize(reader.GetPageSizeWithRotation(1));
document.NewPage();

//Insert to Destination on the first page
if (i == 1)
{
Chunk fileRef = new Chunk(" ");
fileRef.SetLocalDestination(filename);
document.Add(fileRef);
}

page = writer.GetImportedPage(reader, i);
rotation = reader.GetPageRotation(i);
if (rotation == 90 || rotation == 270)
{
cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
}
else
{
cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
}
}
}
catch (Exception e) { throw e; }
finally { document.Close(); }
}
#endregion

#region Properties
///
/// Gets or Sets the SourceFolder
///
public string SourceFolder
{
get { return sourcefolder; }
set {sourcefolder = value; }
}

///
/// Gets or Sets the DestinationFile
///
public string DestinationFile
{
get { return destinationfile; }
set { destinationfile = value; }
}
#endregion
}
</pre>
<p>To use the MergeEx class:<br />
1) Initialize the class<br />
2) Set the SourceFolder and DestinationFile properties<br />
3) Using the AddFile method, add the source file names that need to be merged (Filename only since the SourceFolder has already been set)<br />
4) Call the Execute Method</p>
<p>If everything works fine you will find your Merged PDF Document at your stated destination file.</p>
<p>The code is pretty much self decribed. If there is any question, i can always be contacted via this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wacdesigns.com/2008/10/03/merge-pdf-files-using-c/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.wacdesigns.com/feed/ ) in 1.10541 seconds, on May 16th, 2012 at 8:17 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 23rd, 2012 at 8:17 am UTC -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  www.wacdesigns.com/feed/ ) in 0.00160 seconds, on May 18th, 2012 at 7:24 pm UTC. -->
