Categories
Kindle Linux Posts

Using pdfcrop to Remove White Margins | Ubuntu

One of the most annoying things about PDF files are their fixed font size, the only real way of getting a better view at the text is to zoom the whole page in. This isn’t really a fix for that annoyance but it’s a way of getting more info to screen ratio by removing the wasted white space around the body of the file for each page, this really comes in useful when displaying PDF files on your Kindle, Nook, Smart Phone or other eBook Readers.

 sudo apt-get install texlive-extra-utils

It’s really simple to use and by default it crops all the white space from around an image, it does this per page rather than for the entire document which allows for the best results (as long as you don’t mind changes in font size when you’re reading it).

Change input.pdf to the name of the file you want to crop and output.pdf to the output cropped file.

 pdfcrop input.pdf output.pdf

Some PDFs have better results than others and some PDFs will look the same on eBook readers if they crop the whitespace, but it’s a useful tool to have for some of those old pesky JPEG PDF files with massive borders all the way around.

Example: Left = input, right = output

Some PDF files seem to bring up the following error:

!!! Error: Ghostscript exited with error code 1!

I’m currently not sure what causes this, possibly something to do with the encoding type of the PDF? or maybe just some missing dependencies..

For more info about pdfcrop check out the Ubuntu Manpage: http://manpages.ubuntu.com/manpages/gutsy/man1/pdfcrop.1.html

Categories
Final Year Project Posts

FYP | mbed + C328 First Image

After spending some time to write mbed drivers for the C328 camera for mbed and then taking a break, it looks like someone swooped in and did a cracking job – http://mbed.org/users/shintamainjp/notebook/CameraC328/. The test program takes uncompressed snapshot (80x60px), uncompressed preview (80x60px), JPEG snapshot and JPEG preview images and stores them on the mbed filesystem which allows you to grab them via USB.

A huge issue it looks like I’m going to face is that it takes on average about 6.9 seconds (or a incredible 0.145fps) to take a 80x60px uncompressed image and around 11.6 seconds (0.08621fps) for a 640x480px JPEG image, which I think may be more down to the camera than the mbed or software. If that is the case, there may be a pretty high chance I’m going to have to switch my camera.

I’ll have to explore the code a little more tomorrow to see how this work (in the hours when it’s not so late/early) but this should be perfect since it should give me more time for vision processing..

jpeg preview
mbed + C328 - JPEG Preview (640x480px)