Monday, January 31, 2011

Installing the .wwf toolkit under Windows

Introduction
Converting a PDF file to .wwf is so trivial under Linux that a bunch of shell scripts is enough to perform that task. When a user asked me whether it could be ported to Windows I was bewildered. Running Unix shell scripts under Windows means you have to trick Windows in thinking it is running a Windows program and the shell scripts in thinking they're running in a Unix environment. But all components were available for Windows, so I decided to give it a try. Note I tried Win98 as well, but that didn't work. You will need WinXP at least.

Preparation
First, you have to download all components:If you don't know what your Windows directory is issue this at the prompt:
echo %windir%

You can get a prompt by starting cmd.exe. I will refer to the Windows directory as C:\WINDOWS.

Installing WGET
Place the executable in C:\WINDOWS - or whatever your Windows directory may be.

Installing Poppler-utils
Unzip the archive and place all executables in C:\WINDOWS.

Installing PDFtk
Unzip the archive. You will only need the files in the bin directory. Place pdftk.exe in C:\WINDOWS and libiconv2.dll in C:\WINDOWS\SYSTEM32. Be sure not to overwrite previous versions!!

Installing Zenity
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

Installing BGstart
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

Installing MSYS
You may also take the newer 1.0.11, but note that version has packaging errors. Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.



Finally, a console will pop up, posing you two questions:
  1. Will you continue the postinstallation [YES]
  2. Have you installed MinGW? [UNLIKELY]
If you installed MinGW before (which is a C-compiler) you probably already have MSYS anyway.

Installing Ghostscript
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

The Windows-version of Ghostscript fortunately comes with Unix scripts of the major utilities. They are all located in the lib directory. You have to add this directory to the path so MSYS can find them. That's not very hard. Simply click the "My computer" icon, then click "Control Panel" and finally "System".



Choose the tab "Advanced" and click the button "Environment variables":



Choose "System variables", then "Path" and add the directory in question up front. Usually, this will be something like C:\Program files\gs\9.00\lib.

Installing .wwf toolkit
MSYS has left an icon on your desktop. Click it. Then navigate to the wwftk-1.7.tar.gz archive. You can use cd as usual, no need to change drives. Note backslashes become slashes and drives become directories, e.g. H:\download\wwftk-1.7.tar.gz becomes /h/download/wwftk-1.7.tar.gz. If the path contains embedded spaces, enclose it with double quotes. Assuming the archive is located at H:\download, issue:
cd /h/download
tar -xzvf wwftk-1.7.tar.gz
cd wwftk-1.7/Windows
sh installwin.sh c

If Ghostscript wasn't installed on the C:-drive adjust accordingly. If all goes well, you'll see the following screen:



After that, .wwf tools is installed.

Post installation
You probably want to start the .wwf tools from the screen. All you have to do is to make two shortcuts. First, click right on the desktop and select "Shortcut":



Second, choose "Browse" and navigate to C:\msys\1.0\share\wwftk\bg_pdf2wwf.bat.



Third, choose a name for this shortcut. I prefer PDF2wwf.



Basically, the shortcut has been created now, but it is not very attractive. Right click it and choose "Properties".



Click "Change icon" and "Browse".



Navigate to C:\msys\1.0\share\wwftk.



Select wwf128.ico.



Select the appropriate icon and press "Ok". Repeat the same procedure for wwf2pdf and you're done.

No comments: