Rotolux

Physics, Python programming, Miscellaneous geekness

Guide to reducing borders around text in a pdf

OK, here’s a howto on using LaTeX with the pdfpages package to strip whitespace from around the text of an existing pdf document. Say you have a pdf with a large blank marginspace around the text. The following LaTeX file will make a new version. Unfortunately, it will lose any bookmarks, links etc. I usually run it with pages={-8} to process just a few pages, tweaking the offset and scale values until it’s stripping out the bits I want, then change back to pages={-} or maybe a different page range to strip out any guff you don’t want. It’ll also let you glue together multiple pdfs into one file.

\documentclass[a5paper,oneside]{book}
\usepackage{pdfpages}
\begin{document}
\pagestyle{empty}
\includepdf[pages={-},offset=0mm -5mm,scale=1.3,pagecommand={}]{”pdf_file_name”}
\end{document}

Guide to reducing the file size of a pdf for the eSlick

I reported a problem to Foxit with reading a few pages of Kevin O'Holleran's 27MB thesis on my eSlick.
Christina from Foxit explained that the error message "! This page cannot be displayed normally" was indicating a memory issue. Therefore, I worked out how to reduce the file size to a comparatively small 3.4MB by re-sampling just the raster images. Now the eSlick handles the file without problems.

To produce the smaller file on a Windows PC:

  1. Install the latest version of the free PDFCreator software v0.9.8.
  2. Open the original file and print it to the PDFCreator printer device.
  3. After the printing Progress bar completes and the printer driver queue empties, the PDFCreator dialog appears. Click the Options button. Click the Ghostscript link. In the Additional Ghostscript parameters field, add the text "-dPDFSETTINGS=/screen" (without the quotes) and click the Save button.
  4. Click the Save button on the PDFCreator dialog.
  5. Enjoy reading your new, lighter ebook

Gutenberg rejoiner

So, what does one do with an e-reader? Why, read project Gutenberg etexts of course. One way to do this if you've got an eSlick is to use feedbooks to generate a nice pdf for you. In your profile settings, feedbooks lets you set up a custom pdf page format. I use 92 x 122mm, 11px Palatino for the eSlick. However, for novels it's probably better to just use a text file. Then the eSlick can reflow the text for you. The trouble is that Gutenberg etexts are filled with unwanted newline characters so they don't flow nicely on screen. What to do? Well, if you use Perl, you could try the script here. Alternatively, if you're a more enlightened Pythonista like me, you could use the following Python script to rejoin the lines (Note: I created this listing using this cool page):

from Tkinter import Tk
from tkCommonDialog import Dialog

class OpenFile(Dialog):
command = "tk_getOpenFile"

rootwin = Tk(); rootwin.withdraw()
fname = OpenFile().show().split('/')[-1]
if fname != '':
print >>open('out_'+fname, 'w'), open(fname).read().replace('\n\n','#uNiQuE#').replace('\n',' ').replace('#uNiQuE#','\n')

First eSlick post


So, I bought a new toy - one of those newfangled e-ink book readers that herald the death of the print industry - not that I've got anything against the print industry. Occasionally common sense takes leave of me and I become an early adopter of something - in this case it's a Foxit eSlick. That's a photo of me holding it, showing a page of David Paganin's Coherent X-Ray optics book. Hopefully this post spells the start of me blogging some helpful tips for making reading with the eSlick a nicer experience.

London

So the fact that I made no entries during my Dublin visit should tell you that I was pretty busy and didn't have very good internet access. I've just arrived in London. Not really feeling like spending time to blog about Ireland except that it was really good, especially the 3 day bus trip tour I did which was great. I'm planning on doing a couple of things whilst in London; the tower and westminster. Unfortunately there's a conference on at Nottingham which may wipe out some of my audience for my visit to Imperial College on Wednesday - hopefully not all of it. I feel like I'm back in civilisation after the Ireland trip - funny that.

Antipenultimate post?

For those keeping count, there was another fire alarm and evacuation and I heard that there was yet another, but it must have been during my night in Bath, so I missed it. Boohoo.

I think this may well be close to the last post here before I return home; possibly the second or third last, simply because I've been busy and haven't been taking many photos.

To remedy this, here's an exciting one of a letterbox.

And some sciencey cushions


Well, I like them anyway - they're in the university chapel, which itself looks really old, but isn't, and which contains a not particularly impressive looking pipe organ, that is (impressive sounding that is). Here's a snapshot of some of the people in the optics group. This was a going-away lunch for me, Ken and Lesley - they both having been in the group for some years. I felt a bit guilty that I was also sharing in their going-away lunch, myself having only been there a short time.

My research activities here haven't been all that successful and may still end up going nowhere, but I've learned a lot and benefited from being in another group, and having some opportunities to talk at a couple of other universities, so I'm judging the trip worthwhile. This week will be a bit weird because most of the group will be off at the Photon08 conference at Heriot-Watt uni. I'll be one of a handful left and my disappearance from the group will likely be surprise to some.

I think all my accommodation and flight organising is almost complete - just a few more things to book and I can say goodbye to that stress. The sun is out today for about the fourth day in a row - the longest stretch since I've been here, but I've been stuck inside again - I needed to pack and weigh my stuff because my flights to Ireland have stricter allowances. I may still run over-weight. I guess that's all for now.

Side trip to England

Apparently I neglected to mention that my BEC paper was published in Phys. Rev. A. Although I missed it, it also made the front page of the ScienceNews website for a day, although like myself I'm not sure that anyone noticed.

I visited Bristol U. last Wednesday and did a talk for the gurus of phase vortices. Mark Dennis whom I was visiting took me over to the Clifton bridge as was recommended as the place to go in Bristol. It stopped raining long enough for this activity.

The bridge and view were worth the reasonably short walk.
Then I made my way to the station and took the 15 minute train ride to Bath, spent the night there, and played tourist for a day on Thursday.
This is Bath Abbey photographed from the Roman Baths.

People don't get to use these baths anymore, but some creatures still do



I did two walking tours of Bath - on the night I arrived I did the Bizarre Bath comedy walking tour, which was pretty good. It's basically a comedian/magician guy doing a one-man (and one mysterious hidden helper) show involving no actual history. I also did the free Mayor's guides tour after seeing the Roman Baths - this is the history one and our guide really knew his stuff.


I had a pasty for lunch and some decent coffee too before making my way back to Bristol. Apparently the other thing to do in Bristol is to see the ss Great Britain. On my return, before catching the plane back to Glasgow, I didn't do this ... but I did have a nice ice cream because the weather was nice, and I visited the St Mary Redcliffe church, which contains a very impressive pipe organ. I would like to have heard it - It looked like it should sound really good.


So, now I'm back in Glasgow, it's back to trying to get some physics done. I haven't been terribly successful on this front so far, but there's still a tiny amount of time. I've booked my flight to Ireland, booked a 3-day tour there and organised to talk about my BEC stuff at Strathclyde U. and Imperial college before I return to Melbourne. Still more accommodation and flight organising to do but it's reasonably set now.

Oh, and the wolf cryer cried again last night, but it was only 11pmish, so no sleep was lost.