<?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>42 &#187; pdf</title>
	<atom:link href="http://www.42.mach7x.com/tag/pdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.42.mach7x.com</link>
	<description>Thoughts and tips about programming with Ruby on Rails</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:38:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pdf with .doc templates using prawn in Ruby on Rails</title>
		<link>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/</link>
		<comments>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 13:21:48 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[doc]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[odt]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[prawn]]></category>
		<category><![CDATA[prawnto]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=138</guid>
		<description><![CDATA[Problem You want to generate pdf documents in your Ruby on Rails app using .doc templates. Solution Open the .doc document in OpenOffice and save it as an Open Document Format (.odt). Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section. Use imagemagick&#8217;s convert [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to generate pdf documents in your Ruby on Rails app using .doc templates.</p>
<p><strong>Solution</strong><br />
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).</p>
<p>Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section.</p>
<p>Use imagemagick&#8217;s convert to make the pdf file to an image (setting the density to your requirements &#8211; default is 72dpi):</p>
<p><span class="code">convert -density 150 one.pdf one.png</span></p>
<p>Copy the image one.png to your rails image directory (public/images).</p>
<p>Use the image as a background to the pdf created by prawnto (install plugin if you don&#8217;t have it) with:</p>
<p><span class="code">templ=&#8221;#{RAILS_ROOT}/public/images/one.png&#8221;<br />
pdf.image(templ, {:position => :center, :vposition => :top, :scale => 0.215})</span></p>
<p>Put the database field(s) text on position (you&#8217;ll have to play around with the coordinates to get it right), like:</p>
<p><span class="code">pdf.font &#8220;#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf&#8221;, :size => 9<br />
pdf.text &#8220;#{@model_name.fielda_name}&#8221;, :at => [100,530]<br />
pdf.text &#8220;#{@model_name.fieldb_name}&#8221;, :at => [100,510] &#8230;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining multiple ps pages into a multiple page pdf file</title>
		<link>http://www.42.mach7x.com/2008/01/25/combining-multiple-ps-pages-into-a-multiple-page-pdf-file/</link>
		<comments>http://www.42.mach7x.com/2008/01/25/combining-multiple-ps-pages-into-a-multiple-page-pdf-file/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 10:22:50 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ghostscript]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[ps]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/2008/01/25/combining-multiple-ps-pages-into-a-multiple-page-pdf-file/</guid>
		<description><![CDATA[Problem You have a lot of ps files and you want to combine them into a single pdf file with multiple pages. Solution You can use Ghostscript: gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.ps in2.ps in3.ps]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You have a lot of ps files and you want to combine them into a single pdf file with multiple pages.</p>
<p><strong>Solution</strong><br />
You can use Ghostscript:</p>
<pre class="code">gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.ps in2.ps in3.ps</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2008/01/25/combining-multiple-ps-pages-into-a-multiple-page-pdf-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

