<?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>Full of BS &#187; FPDF</title>
	<atom:link href="http://fullof.bs/category/programming/php/fpdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://fullof.bs</link>
	<description>He just never stops talking</description>
	<lastBuildDate>Thu, 15 Dec 2011 20:00:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Stupid Sudoku Book Generator</title>
		<link>http://fullof.bs/stupid-sudoku-book-generator/</link>
		<comments>http://fullof.bs/stupid-sudoku-book-generator/#comments</comments>
		<pubDate>Thu, 26 Jan 2006 08:06:35 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[FPDF]]></category>
		<category><![CDATA[My Stores]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Puzzles]]></category>
		<category><![CDATA[Sudoku]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[store]]></category>

		<guid isPermaLink="false">http://blog.sc.tri-bit.com/?p=16</guid>
		<description><![CDATA[I&#8217;m looking for beta participants for my PC client! See http://blog.sc.tri-bit.com/archives/151. The problem? PDF. The solution? FPDF, PHP, and the force of anger incarnate. So, I&#8217;ve got the puzzle drafting application up and running in a non-painful way, which took no small (read: Herculean) effort and a pinch or two of CSS Ninja Magic. This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I&#8217;m looking for beta participants for my PC client!</strong> See <a href="http://blog.sc.tri-bit.com/archives/151">http://blog.sc.tri-bit.com/archives/151</a>.</p>
<p>The problem? PDF. The solution? <a title="FPDF, a free PHP script to generate PDFs" href="http://www.fpdf.org/">FPDF</a>, <a title="PHP, the scriptiest scripting language all week" href="http://php.net/">PHP</a>, and the force of anger incarnate.</p>
<p><span id="more-51"></span><br />
So, I&#8217;ve got the puzzle drafting application up and running in a non-painful way, which took no small (read: Herculean) effort and a pinch or two of CSS Ninja Magic. This means I have a relatively pleasant interface in which to hand-create my sudoku puzzles, instead of this pencil and paper bullcrap slowing me down.</p>
<p>Of course, I like my puzzles (being an egotist that&#8217;s a given, but let&#8217;s ignore that for now.) As a result, I want to share them with others, preferably for money. The logical choice is a place like <a title="Stone Sudoku - quality Sudoku books and merchandise" href="http://cafepress.com/StoneSudoku/">Cafe Press</a> or Lulu, but they both want books kind of already laid out, so they can just print them and be done with them.</p>
<p>This all sounds perfectly reasonable, until that horrible death knell comes gonging around the dark recesses of your animal hindbrain, into places your soul is afraid to go, where ancestral memory remembers stuff like <a title="Down With ELM" href="http://java.com/">dinosaurs</a> and being <a title="Bird Flew" href="http://www.usatoday.com/tech/science/discoveries/2006-01-12-human-ancestors-birds_x.htm">hunted by eagles</a> and <a title="Truman's the Mack" href="http://www.amazon.com/gp/product/0671869205/qid=1138261744/sr=8-1/ref=pd_bbs_1/104-2388795-5819116?n=507846&amp;s=books&amp;v=glance">effective presidents</a> and other scary relics of an antiquarian past.</p>
<p>The name of that knell? PDF.</p>
<p>So, in order to provide content for these places, one has to give up a standardized-ish format which is designed for print. Luckily, postscript doesn&#8217;t really much exist in modern tools, so god forbid I be able to go in with a programming language for my layout application, guns a-blazing. (Interject here with fond memories of my father showing me Display PostScript on his NeXTslab as a programming language in which to write actual applications.) At first my plan was to get one of those PDF printer targets like <a title="Primo PDF - a free printer driver that targets PDF" href="http://www.primopdf.com/">Primo</a> going, then to use Word automation from Delphi to do the actual printing. That worked well enough for my blank boards, but it got hella cumbersome when I wanted to do non-trivial boards, so I started to look for alternatives.</p>
<p>Then I found <a title="FPDF, a php library for generating PDFs on the fly" href="http://www.fpdf.org/">FPDF</a>, which in many ways rocks. It&#8217;s a PHP class from which you derive classes which implement printing behaviors. You override methods to handle when page breaks might occur (for example, to set up column driven layout, keep some variable off in a corner somewhere, and when FPDF says &#8220;time to page break,&#8221; you override by saying &#8220;No, just move ten inches to the left and back up to the top.&#8221;) The methods to get things done are relatively straightforward, measured in user-chosen units relative to the edges of the current page, and so on. It&#8217;s relatively pleasant, despite a few seriously annoying bugs.</p>
<p>Granted, it seems either that FPDF only implements a subset of PDF, or that PDF is entirely simpler than I had previously believed. Really, you just have a few graphics primitives with simple color and thickness controls for line and fill, the ability to place form elements and the ability to place images. That&#8217;s pretty much it, and that surprised me.</p>
<p>But, you know what? That&#8217;s all I need for Sudoku. My generation tool now knows how to crap out a homebrew sudoku format (including for all those purty variants I&#8217;ve learned about,) and I have a PHP script that turns many instances of that format straight into CafePress ready books. (Actually, with some tweaking, I intend to extend this script to handle other puzzle types, too. I&#8217;ve got a genuinely funktronic layout model going on, which I&#8217;m getting fairly into.)</p>
<p>So, some standard Sudoku books are on the Very Near Horizon™, as soon as I teach my generator how to put together title pages and instructions pages (there&#8217;s a lot of automatic scaling and placement going on, so that&#8217;s not as trivial as it sounds) and to place some niceties in the books. You&#8217;ll need to <a title="Stone Sudoku - purveyors of fine Sudoku books and merchandise" href="http://cafepress.com/StoneSudoku">buy one</a> to find out what those nicities are, natch.</p>
<p>Right now, my book generator only knows how to draw standard and off-rectangle sudoku (3&#215;3, 4&#215;4, 2&#215;5, et cetera.) Soon, irregular backgrounds. Afterwards, disjoint backgrounds. Promptly following? &#8221;The World&#8221;.</p>
<p>I have some very neat things I intend to reveal on that store in the near future. Be sure to go <a title="Stone Sudoku - your number one source for su doku and nanpure puzzles, books, shirts and merchandise" href="http://cafepress.com/StoneSudoku">buy things</a>. Right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/stupid-sudoku-book-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

