<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Tom Gidden &#187; pdf</title>
	<atom:link href="http://gidden.net/tom/tag/pdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://gidden.net/tom</link>
	<description></description>
	<lastBuildDate>Sun, 01 May 2011 10:35:37 +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>Extracting pages from PDFs on OS X</title>
		<link>http://gidden.net/tom/2009/01/27/extract-pdf-pages/</link>
		<comments>http://gidden.net/tom/2009/01/27/extract-pdf-pages/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 16:54:18 +0000</pubDate>
		<dc:creator>Tom Gidden</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Mac-OS-X]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://gidden.net/tom/?p=66</guid>
		<description><![CDATA[I need to slice and dice a lot of images from a number of multi-page PDF files, but I don't happen to have the right bit of ImageMagick installed on my MacBook Pro.  Instead, I took the slightly longer route of writing a utility to do it.

Mac OS X comes with a neat little utility called "sips" which can be used to transcode images and PDFs.  However, I haven't found any way of telling it to choose a particular page of a PDF file.  I've googled a bit on the subject, and couldn't find anything.
Of course, I could manually extract the pages using "Preview" but there's no fun in that.
ImageMagick would also usually do the trick, but I haven't installed GhostScript as part of ImageMagick, so PDF file support is fairly broken.
Anyway, extracting pages should be a fairly simple thing to do, considering OS X's drawing layer is very closely related to PDF.
I've put the code in my Subversion repository here, so you can extract the XCode project by running:
svn co http://gidden.net/svn/ExtractPagesFromPDF/
at the command-line.
The code is very basic, and doesn't handle encrypted PDFs or anything special, so treat it as "sample code".  Also, I'm no XCode/Objective-C/CoreGraphics expert by any means, so this may not be the best way of doing it!  No warranties, blah blah blah.  Use at will and at your own risk.
How to use:

Build the project in XCode
Get the executable file, "ExtractPagesFromPDF" and put it somewhere in your $PATH
ExtractPagesFromPDF myBigDocument.pdf
The subpages should be created in the current directory, with the format %04d.pdf (ie. 0001.pdf, 0002.pdf, ...).  If you have files with those names already, move them out of the way!

Now that's written, I can now use "sips", "ImageMagick", etc. to continue the processing I need to do for the project.]]></description>
		<wfw:commentRss>http://gidden.net/tom/2009/01/27/extract-pdf-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

