Archive for February, 2013

Unlocking Secured Password Protected PDF Files

Saturday, February 23rd, 2013

Out of all the possible file formats out there, translating a PDF document is usually the worst-case scenario. The only thing worse than a PDF, is a locked password-protected PDF with security settings that don’t allow you to even copy and paste text out of it. It’s very difficult to look up Japanese words if you can’t copy the text, and you definitely can’t make use of translation memory software if you have no access to the text. So here is a simple way to unlock those secured PDFs to get access to the text.

You Will Need

A Linux computer or VM with Ghostscript installed.

How to Unlock the Secured PDF with Ghostscript

We’re actually going to create a identical copy of the PDF that is unlocked. We’ll use Ghostscript to do this. Ghostscript is a PostScript and PDF language interpreter and previewer that is commonly found pre-installed on most major Linux distributions. If it isn’t already installed, it can be easily obtained using your distro’s package management tool.

Using Ghostscript on Linux, you can unlock a PDF with a single command:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=OUTPUT.pdf -c 
.setpdfwrite -f INPUT.pdf

That’s a rather long series of parameters, so let’s break it down so you understand what is going on.

  • The gs command invokes Ghostscript.
  • The -q switch invokes quiet mode, which suppresses a lot of messages that you probably aren’t interested in.
  • The -dNOPAUSE switch enables no pause after each page.
  • The -dBATCH switch will exit after the last file completes.
  • The -sDEVICE=pdfwrite switch selects the device. In this case, we select the pdfwrite device to create a PDF. Ghostscript works with numerous devices for almost every possible format, including graphic formats such as jpeg, tiff, png, bmp, etc.
  • The -sOutputFile=OUTPUT.pdf switch selects the output file that we are creating. We read in a locked PDF, and we create a new, unlocked PDF file called OUTPUT.pdf in this case.
  • The .setpdfwrite operator automatically sets up parameters that are useful for creating PDFs using the pdfwrite output device.
  • Our locked PDF file we want to unlock is INPUT.pdf in this example.

Converting Multiple Files in Batch

Suppose you have an entire directory full of locked PDF files you want to unlock. Here is a quick little Bash script you can do on the Linux command line to unlock all the PDFs at once.

for x in *.pdf
do
   gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=converted_$x -c 
   .setpdfwrite -f $x;
done

In this script, all of the converted PDFs will be prefixed with converted_.

That’s all there is to it. If you have a Linux computer or virtual machine, it just takes one command to create an unlocked copy of the PDF.

Japanese Input on Fedora 18 Linux Spherical Cow

Sunday, February 17th, 2013

Setting up Japanese input IME (日本語入力方法) on Fedora 18 Linux under the Gnome 3 environment is easier than ever. However, it is different from previous Gnome 3 versions of Fedora, such as Fedora 16 and 17.

This quick tutorial will show you how to set up Japanese input with the Anthy input system.

Japanese IME Setup Procedure

To start, open Activities from the Top Panel.

In the Search Box, type Region & Language and select Region & Language.

fedora18-1

Select the Input Sources tab on the Region & Language screen.

fedora18-2

On the Input Sources tab, select the + in the lower left corner to add a new keyboard input source.

fedora18-3

On the Choose an input source dialog box, select Japanese (Anthy).

fedora18-4

Press Add.

Close the Region & Language menu.

You should now have the input language menu in the top bar. The en displayed means English keyboard. Press it and select Japanese (Anthy) to change to Japanese Input.

fedora18-5

The en should have changed to a katakana あ to indicate Japanese input.

fedora18-6

That’s it. You can now type in Japanese.

fedora18-8

Press the katakana あ in the top bar while in Japanese (Anthy) input mode to toggle between various input modes and typing methods.

fedora18-7

For previous versions of Fedora, refer to: