A short exercise in hacking and mashing PDFs
A while back I found W. Ross Ashbys Introduction to Cybernetics online as a PDF, but formatted 2-up for printing, which makes it a really bad read on the Kindle. I needed to de-n-up it. But how to. Ghostscript is able to limit the viewport on the synthetic output device pdfwrite to one page - but that only got me all the left pages.
Googling for PDF tools is about as frustrating as googling for antivirus or spamfilters - very, very spammy, tons of bad half-solutions and workarounds for people like me who don't want to pay for Adobe's tools.
After a while I found out how to fix it without downloading anything at all, as long as you're on a Mac. Here's how:
- Crop the pdf to left/respectively right pages only. You can do this with preview - select the right/lift page. Load the inspector (in Tools) and find the crop-tab. Crop and save as leftpages.pdf, then open the original and do the right pages as rightpages.pdf
- REALLY crop the pdf. What you just did only defined some metadata in the PDF that tells viewers which part of the pdf to show. This breaks down a little later in this workflow, so you need to actually cut the pdf. You can do this using Ghostscript (which I might have installed by hand using macports, I forget)
gs -g4210x5950 -sDEVICE=pdfwrite -sOutputFile=realrightpages.pdf -dUseCropBox=true -dBATCH -dNOPAUSE -f rightpages.pdf
The 4210 and 5950 are the width and height, respectively in pixels - for this pdf, this mac and this install of ghostscript there are 10 pixels to a point - and you can read off the point dimensions in the inspector in preview.
- Interleave left and right pages using the automator.
- Open Automator
- Start a new workflow
- Drag your files to the workflow windows, left pages first
- In the PDF tasks, find "Combine PDFs" and choose "shuffling" mode, which takes pages from first file and second file alternately
- You're done!
Posted by Claus at
11:54 PM
|
Comments
(0)
New control opportunities
Just wanted to share a little proof of concept of Sinatra + Websockets + Applescript for browser based UI to anything on your Mac.
You need to
sudo gem install thin em-websocket sinatra rb-appscript
or something like that. Then you probably need to have iTunes running, but given these you should be able to run
this ruby script, go to http://localhost:5000 in your browser and search for your iTunes music.
I used the well rounded
appscript tools to figure out how to control iTunes.
Posted by Claus at
11:28 PM
|
Comments
(0)