• Category Archives Uncategorized
  • Compress PDF for College Applications

    It’s always a rush: the deadline is approaching, there’s exams coming up, you are applying for a chance to study in your dream college next year.  As you near the end of the application form, they always want soft-copies of your certificates, in PDF.

    And of course, the online application always has some ridiculously low file size limit.  They often have file number limits too, meaning that you have to combine your scanned certificates all into a single PDF.

    Recently, I was applying for a Ph.D. where I must upload all my certificates, supporting documents, SOP, filled application, etc. as a single PDF file.  And of course there was an unrealistically small size limit.  For another application, I could upload three documents, but they must all be less than 2MB.  Yet another application required that the PDF file have all pages rotated to the correct orientation.

    How is a full A4 certificate or transcript, two pages, full color, scanned at 300dpi, supposed to fit in 2MB?!?  My PDF, all told, was 13MB, and about 5 pages (Bachelor’s certificates, MSc certificates, diplomas, etc).  And it had to fit in 2MB???  I assume that it should also be legible?

    Well, the answer is, yes, we can!  The answer to all your PDF worries is ImageMagick and PDF Tool Kit (aka pdftk) – wonderful life-saver programs present on most GNU/Linux systems.

    Not on Linux?  My friend, my friend, it’s time to free yourself!  Download Linux Mint and give it a spin!  You can even run LinuxMint from the DVD, just for the purpose of using PDF Tool Kit, if you’re that desperate.

    Still not on Linux?  Well, you can always use Adobe Acrobat Pro, but it is costly!  I happen to have a licensed version of Adobe software, which I do use on occasion.  However, more and more often, I don’t need to use it because there’s a perfectly fine free, open source alternative.

    Well, if you’ve come here looking for answers on “How do I compress my PDF?”, I shouldn’t keep beating around the bush.

    Compress your PDF of Scanned Documents:

    There are a number of solutions you’ll find via Google.  I’ve tried them all, with little success.  Finally, I found a command that actually works:

    convert -density 300×300 -quality 5 -compress  jpeg input.pdf output.pdf

    Change input.pdf and output.pdf to suit your needs.  I have found that (surprisingly!) using a quality of 5 usually is legible.  You can increase it up to 100.  I usually convert the big file once using this command, take a look at it, and increase the quality if the file is under the size limit, or decrease if it’s too big.

    There’s a lot more that ImageMagick can do for you.  To see some more examples, check out CatlingMindSwipe (including how to convert a JPG into a PDF).

    Re-organize / Rotate pages in a PDF file:

    Another task usually involved in submitting applications is rotating your PDF files, chopping out pages that you don’t want to send, or combining many PDF files into a single PDF.

    Yes, there are a number of online sites that will combine files for free, edit them, etc., but why would you use them?  There’s a better way to do this, right at your finger tips!

    PDF ToolKit (from now on, just pdftk) lets you do all this in a very nice, simple interface.  To know the full power, just type “man pdftk”, and be overwhelmed with the power suddenly in your control!  For a quick start, read on:

    Scenario: You scanned your certificate, and saved it as a PDF, but it’s sideways.  You need to rotate it.

    pdftk A=input.pdf cat AE output output.pdf

    Explanation: You read the input file to A, then you put A in the cat’s dish, then you rotate it towards the East (picture the document sitting on a compass rose), and then out output it to output.pdf.  It might sound strange, but cat actually doesn’t represent a feline, it’s short for concatenate, or join-files-together.  Here, you’re joining A (rotated to the E) with nothing, so it’s just A.  You can also rotate a document West (W), or to the South (S).

    Scenario: You need to upload a bunch of certificates, but can only upload one file.  Let’s use that cat!

    pdftk A=input1.pdf B=input2.pdf C=input3.pdf cat A B C output output.pdf

    Now cat makes sense!  Basically, you’re just joining A, B, and C into one file, output.pdf.

    You can have as many input files as you need (I’ve gone all the way to L).  If you get strange errors, and you’re pretty sure that the command was correct, then one of your PDFs might be malformed.  Try removing one input file at a time from the command until it works, then you know which one was the culprit.  If you are joining huge documents, you might get out of memory issues: just join them into two bunches, and than join the two bunches with another command.

    Scenario: You need to extract some pages of a book to send your writing sample.  For the example, let’s say you need to extract pages 2-10.

    pdftk A=input.pdf cat A2-10 output output.pdf

    That’s it!  Quite simple!  We can make it more complicated… say that, on top of that, you need to rotate the pages 90° to the west (you scanned them the wrong way):

    pdftk A=input.pdf cat A2-10W output output.pdf

    Scenario: You need to do all the above!

    pdftk A=writing_sample.pdf B=scanned_Diploma.pdf C=transcript.pdf cat A2-10W BE C output My_Documents.pdf

    This takes your scanned Writing_Sample.pdf, extracts pages 2-10, rotates them to the West so that your reviewers can read it online without cricking their necks, then rotates your Diploma East for the same reason, and tacks on your transcripts, all into a single file that you can upload called My_Documents.pdf!

    If My_Documents.pdf is too big, try compressing it using the convert command (above).

    Good Luck with your applications!  What’s your favorite way to handle PDFs?

  • The Case for Dark System Themes: How to Save your Eyes and Use a Computer at the Same Time

    When I was young(er than I am now), I didn’t like black deco.  I thought it was evil.  I thought that a computer, used for word processing, should always have a white background just like a sheet of paper.  I thought that the command prompt with it’s white text on a black background was archaic.

    And I was in good company.  Even Apple seemed to agree with my sense of UI deco.

    Then I started to use a computer.  I started to really use a computer, like 10 to 12 hours a day, eight days a week.  I quickly discovered that staring at little shadows on a big square light bulb was not good for my eyes.

    This made me completely reconsider my sense of digital UI deco, and to collect a set of tools to help me reduce eye strain.  I present them here as that’s what this blog is for!

    System Theme

    Always find a plain black theme.  Not a black theme with fancy accents that makes your window trim look like it was painted and waxed in a Porsche Body Shop; a matte black with minimal fanciness is the best.  In KDE, I use the Oxygen-Dark theme.  I’ve also downloaded other theme components that provide green accents rather than blue.  I prefer black and green, especially when I’m running Linux Mint.

    Edit: Firefox has always been troublesome on a dark theme, because if the website doesn’t include full styling for text fields and form input elements, it will mess up their display.  This page shows you an easy and excellent way to fix that: http://ubuntuforums.org/showthread.php?t=1715031

    Note: I’ve never had luck with LibreOffice and a dark system theme.  When I need to do anything that needs to see colors, I have to change the system theme temporarily.  Does anyone know a solution?  EDIT 2014 02 06: It works!  See below:

    Office Apps

    LibreOffice / OpenOffice can work, even in Dark Themes!  If you do a lot of word processing in Writer, then this won’t help you save your eyes, but it will help you see the document as intended.

    Do this:

    • Open LibreOffice or OpenOffice
    • Tools > Options…
    • LibreOffice > Accessibility
      • UNcheck the option to automatically detect high contrast mode
    • LibreOffice > Appearance
      • Make the document background White, instead of Automatic (or a shade of gray to reduce eye strain)
      • Make the application background gray, to reduce the contrast between the white paper and the dark borders
      • Make the font color Black.
    • Click OK, quit Office, and open it again.  Now your presentations and spreadsheets will work as they should.


    RedShift or F.Lux

    These two tools (you only need one of them) tint your computer screen towards warmer colors based on the time of day.  The “white” light emitted from your monitor can be described in terms of color temperature, a measurement in Kelvin.  Basically, a “low temperature” white, say 5000K, will have a “warm” redder color, while a “high temperature” white, around 7000K, will have a “cool” bluer color.

    The important point here is that the color of your monitor should match the color of the ambient lighting to reduce eyestrain.  For a typical office with warm light bulbs and sufficient windows, the ambient light color will go from warm in the morning to cool at midday, and back to warm.  RedShift makes the assumption (and is generally correct) that this is the case, while F.Lux has a more complicated configuration to match any ambiance.

    If you’re using a laptop, then I recommend RedShift as a good general case, as staring at a warm colored monitor while in a room lit by cool lighting is not half as straining as the other way around.  On the other hand, if you are at a fixed computer with predictable ambient lighting conditions, then install F.lux and configure it to perfection.

    On Linux, either of these programs can be downloaded from the repository.  Install redshift and gtk-redshift (the control panel), and configure it to auto start when you log in.  Make sure your system clock is set to the right time zone and location, redshift will do the rest.

    Note: You will want to disable these tools when you are doing color-sensitive work, previewing images, and watching movies for the best results.  It’s usually simple: just click on the icon near the clock in your system tray.


    I used to use Compiz, which had a most wonderful feature: I could invert the color of any window I was looking at.  This is only really useful if you are reading a PDF: black on white.  Invert the window, and you have white on black!  Much better for the eyes.  Now my system no longer has Compiz, and the new compositors don’t seem to have that live-saving feature.  Hopefully it will come back…

    Regular Breaks

    Regular breaks (every 20 or 25 minutes or so) where you stare at some very distant object, such as the scene out the window, do wonders.  I must confess I’m not the best at following this particular piece of advice.


    Well, there you have it!  My toolkit for reduced eye-strain, and longer productivity.  Enjoy!

    You may ask: Why is this website all black-on-white?  The truth is that I haven’t yet overridden the default CSS to switch it to white-on-black.