<?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>Pixelbath</title>
	<atom:link href="http://www.pixelbath.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pixelbath.com</link>
	<description>Webcomics, video, Photoshop and other design-related stuff</description>
	<lastBuildDate>Fri, 10 Mar 2023 17:21:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.10</generator>
	<item>
		<title>C#: Value does not fall within the expected range</title>
		<link>https://www.pixelbath.com/2020/03/c-value-does-not-fall-within-the-expected-range/</link>
					<comments>https://www.pixelbath.com/2020/03/c-value-does-not-fall-within-the-expected-range/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Mon, 30 Mar 2020 20:29:40 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[quick tip]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1343</guid>

					<description><![CDATA[To save anybody from a fruitless internet search, the default message for ArgumentException is the phrase &#8220;Value does not fall within the expected range&#8221;. This error may be returned from various sources, but in my case it was an explicit throw: So if this error is bubbling up, it&#8217;s an ArgumentException.]]></description>
										<content:encoded><![CDATA[<p>To save anybody from a fruitless internet search, the default message for <code>ArgumentException</code> is the phrase &#8220;Value does not fall within the expected range&#8221;. This error may be returned from various sources, but in my case it was an explicit throw:</p>
<code class="javascript"><br />
if (someInvalidValue)<br />
{<br />
    throw new ArgumentException();<br />
}<br />
</code>
<p>So if this error is bubbling up, it&#8217;s an <code>ArgumentException</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2020/03/c-value-does-not-fall-within-the-expected-range/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fantasy Consoles</title>
		<link>https://www.pixelbath.com/2020/02/fantasy-consoles/</link>
					<comments>https://www.pixelbath.com/2020/02/fantasy-consoles/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Mon, 10 Feb 2020 20:20:24 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fantasy consoles]]></category>
		<category><![CDATA[gaming]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1325</guid>

					<description><![CDATA[I&#8217;d been meaning to write for my blog, since I&#8217;m now posting more regularly on Twitter, and am fairly active in a few Discord chats. Most of what I&#8217;ve been doing lately has been centered around fantasy consoles. Fantasy Consoles? While there are differing opinions on exactly what constitutes a fantasy console, the basic idea [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;d been meaning to write for my blog, since I&#8217;m now posting more regularly on Twitter, and am fairly active in a few Discord chats. Most of what I&#8217;ve been doing lately has been centered around fantasy consoles.</p>
<h3>Fantasy Consoles?</h3>
<p>While there are differing opinions on exactly <em>what</em> constitutes a fantasy console, the basic idea is that it&#8217;s a game development platform for hardware that doesn&#8217;t exist. In some cases, there are entire <em>systems</em> dedicated to maintaining the illusion that somewhere in an alternative universe, these video game consoles could have existed.</p>
<h3>Why Fantasy Consoles?</h3>
<p>The most appealing aspect of developing on these platforms is the artificially-imposed constraint that working within a proscribed set of parameters affords. That&#8217;s a mouthful, but it&#8217;d probably be simpler to explain the idea with some practical examples.</p>
<p><div id="attachment_75" style="width: 334px" class="wp-caption alignright"><a href="https://www.pixelbath.com/wp-content/uploads/jelpi_demo.gif"><img aria-describedby="caption-attachment-75" decoding="async" src="https://www.pixelbath.com/wp-content/uploads/jelpi_demo.gif" alt="" width="256" height="256" class="size-full wp-image-1326" /></a><p id="caption-attachment-75" class="wp-caption-text">Pico-8 demo cart</p></div>Let&#8217;s take the first and probably most well-known fantasy console out there, Pico-8. If the Pico-8 system were a real console, it would have lower color specs and resolution than a Game Boy Color with two less buttons. Its specs are as follows:</p>
<p><strong>Display resolution</strong>: 128&#215;128 pixels, 16 pre-set colors (through an additional palette 16 additional colors <a href="https://www.lexaloffle.com/bbs/?tid=35253">have been discovered</a>)<br />
<strong>Audio</strong>: 4-channel &#8220;bloops&#8221; (basic FM synthesis) simultanous<br />
<strong>Input</strong>: Up to 4 six-button gamepads<br />
<strong>Memory</strong>: Up to 32k for each cartridge<br />
<strong>Language</strong>: Customized version of Lua</p>
<p>Cartridges for this platform are stored in the lower bits of the color channels in a standard PNG image, so the &#8220;cartridge&#8221; file actually contains all the relevant game data. The system itself comes with a feature to browse finished games, so Pico-8 can be used as a standalone console.</p>
<p>While you&#8217;d think that being limited to 128&#215;128 pixels with only 16 colors at a time is fairly limiting, the community itself has made the platform an overwhelming success, and they continue to push out amazing games using a highly constrained format.</p>
<div id="attachment_77" style="width: 334px" class="wp-caption aligncenter"><a href="https://freds72.itch.io/virtua-racing"><img aria-describedby="caption-attachment-77" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/pico8-virtuaracing2.gif" alt="" width="128" height="128" class="wp-image-1327" /></a> <a href="https://krajzeg.itch.io/dank-tomb"><img aria-describedby="caption-attachment-77" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/pico8-danktomb2.gif" alt="" width="128" height="128" class="wp-image-1328" /></a> <a href="https://wombart.itch.io/league-of-pico"><img aria-describedby="caption-attachment-77" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/pico8-leagueofpico2.gif" alt="" width="128" height="128" class="wp-image-1329" /></a> <a href="https://www.lexaloffle.com/bbs/?tid=32724"><img aria-describedby="caption-attachment-77" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/pico8-lowmemsky2.gif" alt="" width="128" height="128" class="wp-image-1330" /></a><p id="caption-attachment-77" class="wp-caption-text">Some example Pico-8 games (click each to visit)</p></div>
<h3>More Fantasy Consoles</h3>
<p>Since Pico-8, there have been a slew of other fantasy consoles released, some with similar design goals, and some that are completely esoteric. I am currently maintaining a (mostly up-to-date) <a href="http://homebrew.pixelbath.com/wiki/Fantasy_console">list of all the fantasy consoles</a> I can find (let me know if I&#8217;m missing yours!). I&#8217;ve also helped a couple <a href="https://gardrek.itch.io/vvpet">other people</a> with <a href="https://github.com/Torbuntu/Leikr">their systems</a>, and learned some different programming languages on the way.</p>
<h3>Resources</p>
<h3>
<p>If you need help getting started, check out the <a href="http://homebrew.pixelbath.com/wiki/Fantasy_console">fantasy console list</a>. If you&#8217;re looking for a well-established product with tons of community support, I really can&#8217;t recommend Pico-8 enough. It&#8217;s not free (at $14.99), but it&#8217;s one of the more polished systems out there.</p>
<p>My personal fantasy console recommendations are as follows:</p>
<ul>
<li><a href="https://www.lexaloffle.com/pico-8.php">Pico-8</a> ($14.99) &#8211; The original. Has a huge community following, and is the origin of <a href="https://twitter.com/search?q=tweetcart">#tweetcart</a>.</li>
<li><a href="https://tic.computer/">TIC-80</a> (free) &#8211; This project came out almost directly on the heels of Pico-8. It has similar, but far less constraints, with a low barrier to entry.</li>
<li><a href="https://pixelvision8.github.io/Website/">PixelVision 8</a> ($14.99) &#8211; A system that lets you design your own constrained system, then make a game for it.</li>
</ul>
<p>To discuss with other like-minded individuals, check out these Discord servers:</p>
<ul>
<a href="http://discord.gg/EwQ86eq">Pico-8</a> &#8211; Useful for things other than Pico-8, but mostly centered around Pico-8.<br />
<a href="https://discord.gg/3Kj9fsTn2x">Fantasy Consoles</a> &#8211; Includes most other smaller fantasy console channels.
</ul>
<p>There&#8217;s also a <a href="https://fantasyconsoles.org/wiki">Fantasy Consoles wiki</a> with more information on different FCs.</p>
<h3>Making Games</h3>
<p>And finally, what blog post would be complete without a little self-promotion? While working on the Leikr fantasy console, I turned a small demo into a &#8220;full&#8221; Flappy Bird style clone! The gameplay isn&#8217;t much to be impressed about, but all assets in the game were made by me: graphics, code, sounds, and music.</p>
<p>Update: Took down the game link because I broke it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2020/02/fantasy-consoles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ROM Checksums and Headers</title>
		<link>https://www.pixelbath.com/2019/08/rom-checksums-and-headers/</link>
					<comments>https://www.pixelbath.com/2019/08/rom-checksums-and-headers/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Mon, 05 Aug 2019 23:08:58 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[nes]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1308</guid>

					<description><![CDATA[Lately I&#8217;ve been futzing around with classic game ROMs a bit more. Since nearly day one of Nesticle hitting the Internet, I&#8217;ve been obsessed with emulation of classic computer systems. I love playing old video games, and I love learning more about the internals of the systems I cut my teeth on back in the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_1313" style="width: 205px" class="wp-caption alignright"><a href="https://www.pixelbath.com/wp-content/uploads/romtests-nes-header.png"><img aria-describedby="caption-attachment-1313" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/romtests-nes-header.png" alt="" width="195" height="118" class="size-full wp-image-1313" srcset="https://www.pixelbath.com/wp-content/uploads/romtests-nes-header.png 195w, https://www.pixelbath.com/wp-content/uploads/romtests-nes-header-150x91.png 150w" sizes="(max-width: 195px) 100vw, 195px" /></a><p id="caption-attachment-1313" class="wp-caption-text">NES ROM header</p></div>Lately I&#8217;ve been futzing around with classic game ROMs a bit more. Since nearly day one of Nesticle hitting the Internet, I&#8217;ve been obsessed with emulation of classic computer systems. I love playing old video games, and I love learning more about the internals of the systems I cut my teeth on back in the day.</p>
<p>But this post isn&#8217;t about nostalgia; it&#8217;s about organizing games, specifically ROM files. While I&#8217;m fairly certain I&#8217;ve got several discs (and old HDDs) filled with variously-complete ROM sets for various platforms, these were mostly collected from newsgroups <em>waaay</em> back in the day and as a result have a wide variety of headers, possible trainers, and intros. Nowadays, even the Internet Archive maintains full sets of &#8220;no-intro&#8221; ROMs donated by people who stayed in the scene far longer than I did.</p>
<p>If you intend to organize such a non-trivial amount of games, you&#8217;re gonna need some ROM utilities. The most well-known of these are clrmamepro, RomCenter, and RomVault. I&#8217;m sure there are others, but these are the big players. I&#8217;m not really going to speak about their various strengths/weaknesses, as that&#8217;s a little outside the scope of this post.</p>
<p>What I actually want to discuss is how checksums are calculated using the &#8220;datfiles&#8221; provided by the No-Intro site&#8217;s users. I had a hard time finding this information initially, so I&#8217;m putting it here for anyone else. Also, if I&#8217;m wrong, I&#8217;d love to be called out and told what I&#8217;m doing wrong.</p>
<p>I&#8217;m using the following:</p>
<ul>
<li><a href="https://archive.org/details/no-intro-nintendo-nintendo-entertainment-system-20170618" class="external">No Intro NES ROM set</a></li>
<li><a href="https://datomatic.no-intro.org/index.php?page=download" class="external">Dat-o-Matic Fulltitle NES datfile</a></li>
<li><a href="http://datomatic.no-intro.org/stuff/header_nes.zip" class="external">clrmamepro iNES header config</a> (not linked from anywhere I could see on the No-Intro site)</li>
</ul>
<p>I only found the clrmamepro iNES header config far later than the rest of this info. This specific file is fairly sparse, and only has the following:</p>
<p><code lang="xml">&lt;detector&gt;<br />
  &lt;name&gt;No-Intro NES Dat iNES Header Skipper&lt;/name&gt;<br />
  &lt;author&gt;Yakushi~Kabuto&lt;/author&gt;<br />
  &lt;version&gt;20070321&lt;/version&gt;<br />
  &lt;rule start_offset=&quot;10&quot;&gt;<br />
    &lt;data offset=&quot;0&quot; value=&quot;4E4553&quot;/&gt;<br />
  &lt;/rule&gt;<br />
&lt;/detector&gt;</code></p>
<p>Basically, take this to mean we&#8217;re starting at offset 0x10 and reading to EOF (NES files aren&#8217;t larger than 0x4e4553 bytes). Once I did this, my CRC32 checks started working. I&#8217;d normally stop there, but it looks like my MD5 and SHA-1 hashes are wrong. Adding the entire file back in fixes this, so&#8230;I&#8217;m not really sure why we&#8217;re bothering to trim the header for only one check.</p>
<p>To sum up:</p>
<p>CRC32 &#8211; 0x10 through EOF<br />
MD5 &#8211; entire file<br />
SHA-1 &#8211; entire file</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2019/08/rom-checksums-and-headers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Let&#8217;s Get Cuddly! (or not, I&#8217;m not judging)</title>
		<link>https://www.pixelbath.com/2019/06/visual-studio-cuddly-braces/</link>
					<comments>https://www.pixelbath.com/2019/06/visual-studio-cuddly-braces/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Fri, 07 Jun 2019 18:12:46 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[braces]]></category>
		<category><![CDATA[visual studio]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1303</guid>

					<description><![CDATA[As a personal preference, I&#8217;m a fan of cuddly braces. It&#8217;s the way I learned, but I feel like it leads to more concise and readable code in most cases. I could go on, but as a topic it&#8217;s been beaten to death, and there are arguments with merit on both sides. That being said, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>As a personal preference, I&#8217;m a fan of cuddly braces. It&#8217;s the way I learned, but I feel like it leads to more concise and readable code in most cases. I could go on, but as a topic it&#8217;s been beaten to death, and there are arguments with merit on both sides.</p>
<p>That being said, at work we use newline braces, and I don&#8217;t like it. A good programmer follows the in-place coding style, so that&#8217;s what I&#8217;ve been doing. It doesn&#8217;t mean I have to like it, though. While I use a separate installation of Visual Studio on an entirely different computer for coding my personal projects, there are times where I&#8217;d like to not have to completely switch machines to bang out some lines of code.</p>
<p>After reading that you can export and import Visual Studio settings, I created two settings files trimmed down to only include indentation and newline settings, so now I can simply import a settings file and all the rules I want changed are changed.</p>
<p>Feel free to edit the below files to your needs:</p>
<p><a href="/downloads/VS_Personal.vssettings">VS_Personal.vssettings</a> (3.6k) &#8211; Cuddly style<br />
<a href="/downloads/VS_Work.vssettings">VS_Work.vssettings</a> (3.6k) &#8211; Non-cuddly style (braces on newlines)</p>
<p>These are only for Visual Studio, though. I&#8217;ve got nothing to offer for other editors, but feel free to contribute settings files for any other IDE.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2019/06/visual-studio-cuddly-braces/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSA: Vertex and Vertices</title>
		<link>https://www.pixelbath.com/2019/05/psa-vertex-and-vertices/</link>
					<comments>https://www.pixelbath.com/2019/05/psa-vertex-and-vertices/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Tue, 28 May 2019 16:16:41 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[vertex]]></category>
		<category><![CDATA[vertices]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1298</guid>

					<description><![CDATA[Hey everybody, just a quick reminder that the singular form of vertices is vertex. There is no such thing as a &#8220;vertice&#8221;. I&#8217;ve heard it pronounced this way in video tutorials (especially from one specific &#8220;guru&#8221; who knows a lot about Blender ;), but recently I&#8217;ve noticed this malapropism being used in written tutorials as [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hey everybody, just a quick reminder <strong>that the singular form of vertices is <em>vertex</em></strong>. There is no such thing as a &#8220;vertice&#8221;.</p>
<p><a href="https://www.pixelbath.com/wp-content/uploads/vertices-wrong-word.png"><img decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/vertices-wrong-word-300x59.png" alt="the singular form of &quot;vertices&quot; is &quot;vertex&quot;" width="300" height="59" class="alignright size-medium wp-image-1300" srcset="https://www.pixelbath.com/wp-content/uploads/vertices-wrong-word-300x59.png 300w, https://www.pixelbath.com/wp-content/uploads/vertices-wrong-word-150x30.png 150w, https://www.pixelbath.com/wp-content/uploads/vertices-wrong-word.png 757w" sizes="(max-width: 300px) 100vw, 300px" /></a>I&#8217;ve heard it pronounced this way in video tutorials (especially from one specific &#8220;guru&#8221; who knows a lot about Blender ;), but recently I&#8217;ve noticed this malapropism being used in written tutorials as well.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2019/05/psa-vertex-and-vertices/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Importance of Order</title>
		<link>https://www.pixelbath.com/2019/03/the-importance-of-order/</link>
					<comments>https://www.pixelbath.com/2019/03/the-importance-of-order/#respond</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Sat, 30 Mar 2019 22:52:11 +0000</pubDate>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[command line]]></category>
		<guid isPermaLink="false">https://www.pixelbath.com/?p=1243</guid>

					<description><![CDATA[The order of things is important; even moreso when those things are command line arguments. After spending way too long (~30 minutes) trying to figure out why my background Blender renders were producing default cubes when that is clearly not what is in the scene, I finally looked at the console output and understood. blender [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The order of things is important; even moreso when those things are command line arguments.</p>
<p><img decoding="async" src="https://www.pixelbath.com/wp-content/uploads/default-cube-render.png" alt="" width="630" class="alignright size-full wp-image-1245" srcset="https://www.pixelbath.com/wp-content/uploads/default-cube-render.png 960w, https://www.pixelbath.com/wp-content/uploads/default-cube-render-150x84.png 150w, https://www.pixelbath.com/wp-content/uploads/default-cube-render-300x169.png 300w, https://www.pixelbath.com/wp-content/uploads/default-cube-render-768x432.png 768w" sizes="(max-width: 960px) 100vw, 960px" />After spending way too long (~30 minutes) trying to figure out why my background Blender renders were producing default cubes when that is clearly <em>not</em> what is in the scene, I finally looked at the console output and understood.</p>
<p><code>blender --background --python script.py myfile.blend</code></p>
<p>What this command does is tells Blender, &#8220;Load into memory as a background process and run script.py (which changes some settings and starts a render). <em>Then</em> load myfile.blend.&#8221; Once the file is loaded, background Blender exits.</p>
<p>In the proper order:</p>
<p><code>blender myfile.blend --background --python script.py</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2019/03/the-importance-of-order/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHP PDF Libraries</title>
		<link>https://www.pixelbath.com/2015/04/php-pdf-libraries/</link>
					<comments>https://www.pixelbath.com/2015/04/php-pdf-libraries/#comments</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Wed, 01 Apr 2015 16:03:16 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://www.pixelbath.com/?p=1028</guid>

					<description><![CDATA[I wanted to do something I figured would be relatively simple. After all, we&#8217;re doing it in .Net with a third-party library: Create a PDF with text from a database with vector graphics incorporated in the page. Turns out, it&#8217;s pretty easy if you want a paid solution; numerous libraries exist for PHP that are [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_1035" style="width: 335px" class="wp-caption alignright"><img aria-describedby="caption-attachment-1035" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/bike-crash.jpg" alt="PDFs are easy! Like riding a...oh." width="325" height="213" class="size-full wp-image-1035" srcset="https://www.pixelbath.com/wp-content/uploads/bike-crash.jpg 325w, https://www.pixelbath.com/wp-content/uploads/bike-crash-150x98.jpg 150w, https://www.pixelbath.com/wp-content/uploads/bike-crash-300x197.jpg 300w" sizes="(max-width: 325px) 100vw, 325px" /><p id="caption-attachment-1035" class="wp-caption-text">PDFs are easy! Like riding a&#8230;oh.</p></div>I wanted to do something I figured would be relatively simple. After all, we&#8217;re doing it in .Net with a third-party library: Create a PDF with text from a database with vector graphics incorporated in the page. Turns out, it&#8217;s pretty easy if you want a paid solution; numerous libraries exist for PHP that are non-free. If you insist on going free-only though, be warned: here be dragons (maybe).</p>
<p><span id="more-1028"></span></p>
<p>Since this was a low-priority project (read as: for fun), I needed something that&#8217;s free, preferably open source. I tried four of the top PHP PDF libraries, excluding libraries that are part of a larger framework (i.e. Zend Framework has fairly robust PDF functionality, from what I&#8217;ve read).</p>
<p>Skip to the bottom if you&#8217;re not interested in a per-product breakdown.</p>
<h3>FPDF</h3>
<p>I&#8217;ve used <a href="http://www.fpdf.org/">FPDF</a> in the past. My invoice generator that I wrote over 5 years ago actually uses FPDF. The only problem is, that&#8217;s around when the FPDF project was last updated, which means that all the things that bugged me in 2010 are still a problem.</p>
<p>For starters, the API is a bit messy. I mean, it&#8217;s easy to get started, and if you want to just knock out a quick document that also happens to be a PDF, then great. This library is probably for you.</p>
<p>Embedding fonts, for me, was an exercise in frustration. FPDF needs a <code>.php</code> file containing glyph information for FPDF, and a <code>.z</code> file that contains the gzipped font. It doesn&#8217;t always work, and there&#8217;s no documentation explaining the errors. One issue that kept popping up was the failure to generate the .z file, which I ended up working around and creating myself.</p>
<p>More to the point of my immediate need, though: FPDF only supports JPEG, PNG, and GIF (if GD is installed). It&#8217;s important for this project that the PDF contain only vector artwork, so that was a no-go from the start.</p>
<h3>TCPDF</h3>
<p><a href="http://www.tcpdf.org/">TCPDF</a>, on the other hand, <em>does</em> support vector graphics in the form of SVG, EPS, and even raw Illustrator (.ai) files. EPS and SVG import worked equally well, and the API is a bit cleaner than FPDF.</p>
<p>All fonts are imported via the <code>addTTFfont()</code> method, which is also used for OpenType or Type 1 fonts. After permissions were set up, there was no large issue importing the fonts, aside from TCPDF appearing to discard any hinting or kerning information. The documentation claims to allow for kerning, but the &#8220;tracking/kerning&#8221; demo actually only shows tracking and stretching. When I used an imported font, the kerning went completely random and I had no way to correct it. Seems to work fine with system fonts, though.</p>
<p>Since I needed vector-only artwork and a specific non-system font, TCPDF is out too.</p>
<p>On a marginally-related note, SourceForge is terrible. Please don&#8217;t host code there.</p>
<h3>dompdf</h3>
<p>I read that dompdf (name is lowercase; not just me being lazy) was good at converting HTML to PDFs with styling and background images (which requires GD installed) intact. I will admit, this worked surprisingly well in practice. The library includes an administration panel that allows direct font loading and conversion. This also worked well and I had no issues with it. Fonts seem to use their built-in kerning and tracking and came out looking clean.</p>
<p>The only problem I had with dompdf was that it has no support for vector image formats, even SVG. I hoped SVG support might be coming, since it&#8217;s just more XML and is supported by most modern browsers as a valid image format.</p>
<p>If this project didn&#8217;t absolutely require that there be vector-only artwork (it&#8217;s for a print project), I&#8217;d drop everything else and use dompdf in a second. HTML and CSS is a hell of a lot easier to work with than PHP classes written by someone else.</p>
<h3>FPDI</h3>
<p>So what if, I thought, I could use TCPDF to import the artwork to a &#8220;template&#8221; PDF (or just create the template myself), and use dompdf to create a text-only PDF, then merge the elements?</p>
<p>Enter <a href="http://www.setasign.com/products/fpdi/about/">FPDI</a>. It&#8217;s a library made to work with existing PDF files. In the included examples, it even claims to work with TCPDF, but I found it to be less than clear about how this was working. There was some mention of templates, but I honestly couldn&#8217;t figure out the whole thing.</p>
<p>It requires FPDF, but also claims to be able to use TCPDF instead? I don&#8217;t know. I was unable to find any way to merge to pages into the same page, but plenty of examples of PDF concatenation (not what I want). Perhaps I missed something, but it seemed fairly opaque to me. Exit FPDI.</p>
<h3>Screw It</h3>
<p><img decoding="async" loading="lazy" src="http://imgs.xkcd.com/comics/automation.png" title="'Automating' comes from the roots 'auto-' meaning 'self-', and 'mating', meaning 'screwing'." width="404" height="408" class="alignright" />In the end, I copped out and avoided the PDF generation entirely. Starting from an SVG exported from Illustrator, I&#8217;m stepping through the textual fields with <code>DOMDocument</code> and replacing the text before it&#8217;s sent to the browser. The output is saved directly to the client&#8217;s disk as an SVG file. When that SVG file is dragged into Illustrator, it&#8217;s good to go. Illustrator includes glyph information with the SVG for its own use, so fonts are already set up and correct. I can then just save the file as a PDF with no modifications.</p>
<p>Sure, it&#8217;s not the 100% automated plan I had in the beginning, but this still saves me at least 20 minutes each time I have to do this process. So, a win at least.</p>
<h3>Conclusions</h3>
<p>The free offerings for PHP->PDF libraries kind of suck in their own unique ways. I found <a href="https://github.com/dompdf/dompdf">dompdf</a> to be the slickest of all of them, for sure, but it has some limitations. I&#8217;d heard good things about the <a href="http://framework.zend.com/manual/1.12/en/zend.pdf.html">PDF tool in Zend Framework</a>, but I don&#8217;t use Zend so haven&#8217;t tried it.</p>
<p><a href="https://mpdf.github.io/">mPDF</a> is similar to dompdf in that it converts HTML (including CSS3) to PDF. The examples were ugly, but showed an impressive array of features. I didn&#8217;t end up trying it out, but it looks decent.</p>
<p>If you&#8217;re able to use a non-free solution, I can easily recommend <a href="https://www.pdflib.com/buy/online-shop/pdflib-pdflib-pdi-pps/">PDFLib</a>, but it&#8217;s not cheap ($1150 for a server license). I&#8217;ve used this in the past with different programming languages and found it to be solid. Since it&#8217;s a mature product, there are hundreds of real-world examples of developers using it in actual projects.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2015/04/php-pdf-libraries/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>HP Color LaserJet 3600 Windows 7/8/8.1</title>
		<link>https://www.pixelbath.com/2014/08/hp-color-laserjet-3600-windows-788-1/</link>
					<comments>https://www.pixelbath.com/2014/08/hp-color-laserjet-3600-windows-788-1/#comments</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Thu, 07 Aug 2014 16:43:54 +0000</pubDate>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[laserjet]]></category>
		<guid isPermaLink="false">http://www.pixelbath.com/?p=1024</guid>

					<description><![CDATA[I honestly don&#8217;t know why HP hates its customers. They assume I want to use USB to connect a business printer, or want ~140MB for a driver, or want some other print management software instead of just a driver. So here you go. The HP Color LaserJet 3600 64-bit driver for Windows 7, 8, and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I honestly don&#8217;t know why HP hates its customers. They assume I want to use USB to connect a business printer, or want ~140MB for a <em>driver</em>, or want some other print management software instead of just a driver.</p>
<p>So here you go. The HP Color LaserJet 3600 64-bit driver for Windows 7, 8, and 8.1.</p>
<p><a href="https://www.pixelbath.com/downloads/HP3600_64_Bit.zip">HP3600_64_Bit.zip</a> (14.2 MB)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2014/08/hp-color-laserjet-3600-windows-788-1/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>SimpLESS: An Easier Way of Getting LESS Done</title>
		<link>https://www.pixelbath.com/2013/02/simpless-an-easier-way-of-getting-less-done/</link>
					<comments>https://www.pixelbath.com/2013/02/simpless-an-easier-way-of-getting-less-done/#comments</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Tue, 26 Feb 2013 05:53:58 +0000</pubDate>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[simpless]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://www.pixelbath.com/?p=789</guid>

					<description><![CDATA[When I first took a look at LESS as a CSS replacement, I wasn&#8217;t too interested in having even a command-line compiler. The idea of having my stylesheet loaded and parsed by Javascript didn&#8217;t sound that great either, but tolerable if it saved me enough time and effort writing CSS. While testing LESS on my [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/less-css.jpg" alt="LESS" width="630" height="315" class="size-full wp-image-793" srcset="https://www.pixelbath.com/wp-content/uploads/less-css.jpg 630w, https://www.pixelbath.com/wp-content/uploads/less-css-150x75.jpg 150w, https://www.pixelbath.com/wp-content/uploads/less-css-300x150.jpg 300w" sizes="(max-width: 630px) 100vw, 630px" /></p>
<p>When I first took a look at LESS as a CSS replacement, I wasn&#8217;t too interested in having even a command-line compiler. The idea of having my stylesheet loaded and parsed by Javascript didn&#8217;t sound that great either, but tolerable if it saved me enough time and effort writing CSS.</p>
<p><img decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/simpless.png" alt="SimpLESS" title="simpless" width="346" height="318" class="alignright size-full wp-image-796" srcset="https://www.pixelbath.com/wp-content/uploads/simpless.png 346w, https://www.pixelbath.com/wp-content/uploads/simpless-150x137.png 150w, https://www.pixelbath.com/wp-content/uploads/simpless-300x275.png 300w" sizes="(max-width: 346px) 100vw, 346px" />While testing LESS on my local server, I used <code>less.js</code> to process my <code>.less</code> stylesheet on the client side. It worked well, and on modern browsers the processing time is minimal, but I decided to look around for LESS compilers anyway. I discovered <a href="https://github.com/Paratron/SimpLESS">SimpLESS</a> nearly immediately, and it looked perfect.</p>
<p>Compiling a <code>.less</code> file is as easy as drag-and-drop, and it monitors the file for changes. When your file is saved, it is nearly immediately compiled into a CSS file. If you&#8217;ve made an error in your file, the file highlights red and specifies the line number at which the problem occurred. Output is pure, minified CSS goodness.</p>
<p>SimpLESS, by default, inserts a comment at the top referring to its website. This can easily be disabled if you like.</p>
<p>When I first started using SimpLESS, I was copying and pasting the output into a WordPress template style.css file, which requires a properly-formatted comment at the top to describe the theme. Since SimpLESS performs minification, comments are stripped out. I thought this was the only way to keep my WordPress theme comment intact while still using the features of LESS. This copy-paste tedium was something I specifically wanted to avoid in the first place.</p>
<p><strong>Note: The remainder of this post was written before SimpLESS users complained enough about this very issue, so theme comment preservation is no longer an issue.</strong></p>
<p>I thought that there must be some way to preserve a comment when compiling. Surely that wasn&#8217;t an uncommon use case? I checked out the <a href="https://github.com/Paratron/SimpLESS">SimpLESS source code</a> to see how it was performing its minification (<code>master/Resources/js/clean_css.js, line 30</code> if you&#8217;re interested), and saw they included a special character to preserve certain comments: the exclamation mark.</p>
<p>To preserve a CSS comment in SimpLESS (not that this will not work using the Javascript version, as WordPress will not find a <code>style.less</code> file), simply put an exclamation point after the initial comment delimiter, like so:</p>
<pre>/*!
Theme Name: My Super-Cool Theme
Theme URI: https://www.pixelbath.com/
Description: Blah blah blah...
[cut for length]
*/</pre>
<p>The exclamation point is ignored by WordPress, and if you have SimpLESS processing your style.less file, you can continue to upload your theme&#8217;s <code>style.css</code> file as usual.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2013/02/simpless-an-easier-way-of-getting-less-done/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Clear Photoshop&#8217;s Swatch Palette</title>
		<link>https://www.pixelbath.com/2012/04/clear-photoshops-swatch-palette/</link>
					<comments>https://www.pixelbath.com/2012/04/clear-photoshops-swatch-palette/#comments</comments>
		
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Fri, 13 Apr 2012 15:03:57 +0000</pubDate>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[palette]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[swatch]]></category>
		<category><![CDATA[swatches]]></category>
		<guid isPermaLink="false">http://www.pixelbath.com/blog/?p=606</guid>

					<description><![CDATA[Whether you&#8217;re trying to save a specific set of colors for later use, or simply want a palette with only your colors on it, you&#8217;ll likely have encountered a problem that has been plaguing Photoshop for as long as I remember, and still hasn&#8217;t been addressed in CS5 (or CS5.5, that I know of): how [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_608" style="width: 225px" class="wp-caption alignright"><img aria-describedby="caption-attachment-608" decoding="async" loading="lazy" src="https://www.pixelbath.com/wp-content/uploads/photoshop-swatch-palette.png" alt="The Photoshop swatch palette" width="215" height="168" class="size-full wp-image-608" srcset="https://www.pixelbath.com/wp-content/uploads/photoshop-swatch-palette.png 215w, https://www.pixelbath.com/wp-content/uploads/photoshop-swatch-palette-150x117.png 150w" sizes="(max-width: 215px) 100vw, 215px" /><p id="caption-attachment-608" class="wp-caption-text">Everybody wants a rainbow, apparently.</p></div>Whether you&#8217;re trying to save a specific set of colors for later use, or simply want a palette with only your colors on it, you&#8217;ll likely have encountered a problem that has been plaguing Photoshop for as long as I remember, and still hasn&#8217;t been addressed in CS5 (or CS5.5, that I know of): <strong>how do you clear the swatch palette</strong>?</p>
<p>The only things you <em>can</em> do from Photoshop&#8217;s own menus are:</p>
<ol>
<li>reset the swatch palette to the default colors</li>
<li>replace the palette with a new swatch palette by selecting &#8220;Replace Swatches.&#8221;</li>
</ol>
<p>Anyway, there are two ways to clear the swatch palette completely. Actually, there are three, but one of those is to manually right-click each swatch and select <code>Delete swatch</code>.&#8221; If you&#8217;ve got way too much time on your hands, this would be the way to go. For the rest of us that would rather get on with our lives, there are two better methods of clearing out the palette.</p>
<p>The first method is to do it manually, only with the help of a keyboard shortcut. While holding your mouse cursor over the swatch palette, hold down <span class="key-button">Alt</span> (<span class="key-button"><span class="unicode">⌥</span> Option</span> on Mac). Your cursor should change to a scissors icon (<span class="icon icon-ps-scissors"></span>). Click any color in the swatch palette to delete it. You&#8217;ll have to do this over a hundred times to clear out the palette, but if you&#8217;re a furious clicker like me, you can have this done in under 10 seconds (I play Starcraft, so&#8230;yeah).</p>
<p>The <span class="key-button">Alt</span>/<span class="key-button"><span class="unicode">⌥</span> Option</span> clicking works fairly well, but is still somewhat labor intensive. If you want to clear it even faster, you can download <a href="/downloads/single_swatch.aco">this (mostly empty) swatch file</a>. It includes only one color, black, so you can simply delete this single swatch and begin filling the palette with your own colors.</p>
<p>Download the file below:</p>
<p><a class="button-std icon-aco" href="/downloads/single_swatch.aco">single_swatch.aco (50 bytes)</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pixelbath.com/2012/04/clear-photoshops-swatch-palette/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
