Xournal on Windows

Screenshot of Xournal running natively on Windows Vista

Screenshot of Xournal running natively on Windows Vista

Xournal is a free software note-taking application similar to Microsoft Windows Journal. It used to be Linux-only, with MacOS and Windows ports on the TODO list. But as you can see it is now possible to run it on Windows. Hopefully a nice installer can be created for it, like the ones for Inkscape and Gimp, but for now the process is rather tricky and involves editing and compiling Xournal’s source code.

Update: Denis Auroux, the author of Xournal, has graciously incorporated my code changes into Xournal and made an official Windows release available on the Xournal homepage. Go try it out!

Here’s what I did:

Step 1: Setting up the development environment

We’ll need to set-up a compiler and install all the libraries that Xournal uses (directly or indirectly) before we can compile its source code. Here are the software packages I installed with their version numbers (newer versions will probably work, significantly older versions might not), website addresses (I’d provide direct download links, but they’ll probably end up as dead links as soon as version numbers change), and where I installed them (of course, you’ll probably want to use different paths, unless your name is also Dirk):

MinGW + MSys, a minimalist Unix-like environment for Windows, for the C compiler and other build tools. These can be gotten from MinGW.org:

  • MinGW 5.1.4 (into c:/Users/Dirk/Programming/MinGW)

  • MSys 1.0.11 (into c:/Users/Dirk/Programming/msys)

  • perl 5.6.1_2-1 (into c:/Users/Dirk/Programming/msys/1.0)

  • libcrypt 1.1_1-2 (into c:/Users/Dirk/Programming/msys/1.0)

  • autoconf 2.63-1 (into c:/Users/Dirk/Programming/msys/1.0)

  • automake 1.11-1 (into c:/Users/Dirk/Programming/msys/1.0)

Some Gtk+ and GNOME libraries that Xournal uses for its GUI. These can be gotten from Gtk.org:

  • Gtk+ 2.16.5-20090731 development bundle (into c://MinGW)

  • Cairo 1.8.8-2 binary+dev package (into c://MinGW, overwriting the one from the bundle because the latter is apparently built without FreeType support)

  • FreeType 2.3.9-1 binary+dev package (into c://MinGW)

  • fontconfig 2.7.1-2 binary+dev package (into c://MinGW)

  • win_iconv 20080320 binary+dev package (into c://MinGW)


  • libgnomecanvas 2.20.1 binary+dev package (into c://MinGW)

  • libgnomeprintui 2.12.1 binary+dev package (into c://MinGW)

  • libgnomeprint 2.12.1 binary+dev package (into c://MinGW)

  • libart_lgpl 2.3.20 binary+dev package (into c://MinGW)

and more GNOME.org:

  • libxml 2.7.3 binary+dev package (into c://MinGW)

  • expat 2.0.1-1 binary package (into c://MinGW)

In the C:/Users/Dirk/Programming/MinGW/lib/pkgconfig/libgnomeprint-2.2.pc file we have to make a small change, replacing “pango” by “pangoft2″ on the “Requires:” line, so that in now reads:

Requires: libart-2.0 glib-2.0 gmodule-2.0 gobject-2.0 libxml-2.0 pangoft2

Step 2: Building libpoppler from source

The above gave us all the libraries Xournal needs, except for Poppler. I haven’t seen a pre-compiled binary version for Windows, so we’ll have to build it ourselves. We simply download the Poppler source code, start MSys, cd into the directory where we unpacked the source code, and type:

$ export ACLOCAL_FLAGS=-I/c/Users/Dirk/Programming/MinGW/share/aclocal/
$ ./configure --prefix=/c/Users/Dirk/Programming/MinGW/
$ make
$ make install

(Don’t type the dollar signs, they just indicate the MSys prompt.)

Step 3: Removing Xournal’s screenshot functionality

Once we’ve downloaded Xournal’s source code from the Xournal website, we can’t immediately compile it for Windows. Xournal has one bit of functionality that’s not implemented with the cross-platform Gtk+ library, but instead is implemented directly using X. This will of course not work on different platforms such as Windows.

The functionality in question is in the menu under “Journal > Background screenshot”. On Linux, it hides the Xournal window, then when you click anywhere it’ll bring back the Xournal window with an added screenshot of whatever window you clicked on. There is no way to implement this “clicking on a window”-mechanic in the Windows API, so a proper fix would be to change the mechanic to something different, as the Gimp guys have done. There one drags a crosshair onto a window.

I have not taken the effort to actually implement this different screenshot mechanic, as I don’t use it and it’s a lot easier to just remove it:

  • In src/xo-misc.c in the function hide_unimplemented at the bottom of the file add the lines

    #ifdef WIN32

  • In src/xo-file.c at the top of the file, disable the X-specific #includes under Windows:

    #ifndef WIN32
    #  include <gdk/gdkx.h>
    #  include <x11/Xlib.h>

  • In the same file, replace the body of the attempt_screenshot_bg function to do nothing on Windows:

    struct Background *attempt_screenshot_bg(void)
    #ifndef WIN32
      ... old body here ...
    #else /* WIN32 */
      return NULL;

Step 4: Building Xournal from source

To build Xournal, we just use MSys as before, and inside the xournal directory type the following:

$ export ACLOCAL_FLAGS=-I/c/Users/Dirk/Programming/MinGW/share/aclocal/
$ ./autogen.sh
$ make

Step 5: Running Xournal

To run Xournal we can type

$ src/xournal

or just double-click src/xournal.exe in Windows’s explorer.

If all went well, you’ll see that Xournal “works”, but has some bugs. I’ll describe below how to fix each of these by editing Xournal’s source code. Recompiling (that is, repeating Step 4) will then give you a truly working Xournal. If you don’t want to manually apply all my fixes, you can just download the resulting source code.

Bug 1: The cursor is a big black square

Cursor is a black square and loading/saving doesn't work.

Cursor is a black square and loading/saving doesn't work.

For the pen and highlighter tools, you’ll notice that the cursor is always a 16×16 black square, regardless of the selected color. This is a defect in GDK’s Windows backend (Bug 541377). The function gdk_cursor_new_from_pixmap, which Xournal uses, will only give you monochrome cursors on Windows, and produces strange results when trying to produce a colored cursor.

While this should be fixed on the GDK end, a workaround is to just use different functions from GDK to create colored cursors. This can be done by putting the following code near the top in src/xo-paint.c:

#ifdef WIN32
gboolean colors_too_similar(const GdkColor *colora, const GdkColor *colorb)
  return (abs(colora->red - colorb->red) < 256 &&
          abs(colora->green - colorb->green) < 256 &&
          abs(colora->blue - colorb->blue) < 256);

/* gdk_cursor_new_from_pixmap is broken on Windows.
   this is a workaround using gdk_cursor_new_from_pixbuf. */
GdkCursor* fixed_gdk_cursor_new_from_pixmap(GdkPixmap *source, GdkPixmap *mask,
					    const GdkColor *fg, const GdkColor *bg,
					    gint x, gint y) 
  GdkPixmap *rgb_pixmap;
  GdkGC *gc;
  GdkPixbuf *rgb_pixbuf, *rgba_pixbuf;
  GdkCursor *cursor;
  int width, height;

  /* HACK!  It seems impossible to work with RGBA pixmaps directly in
     GDK-Win32.  Instead we pick some third color, different from fg
     and bg, and use that as the 'transparent color'.  We do this using
     colors_too_similar (see above) because two colors could be
     unequal in GdkColor's 16-bit/sample, but equal in GdkPixbuf's
     8-bit/sample. */
  GdkColor candidates[3] = {{0,65535,0,0}, {0,0,65535,0}, {0,0,0,65535}};
  GdkColor *trans = &candidates[0];
  if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) {
    trans = &candidates[1];
    if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) {
      trans = &candidates[2]; 
  } /* trans is now guaranteed to be unique from fg and bg */

  /* create an empty pixmap to hold the cursor image */
  gdk_drawable_get_size(source, &width, &height);
  rgb_pixmap = gdk_pixmap_new(NULL, width, height, 24);

  /* blit the bitmaps defining the cursor onto a transparent background */
  gc = gdk_gc_new(rgb_pixmap);
  gdk_gc_set_fill(gc, GDK_SOLID);
  gdk_gc_set_rgb_fg_color(gc, trans);
  gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height);
  gdk_gc_set_fill(gc, GDK_OPAQUE_STIPPLED);
  gdk_gc_set_stipple(gc, source);
  gdk_gc_set_clip_mask(gc, mask);
  gdk_gc_set_rgb_fg_color(gc, fg);
  gdk_gc_set_rgb_bg_color(gc, bg);
  gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height);

  /* create a cursor out of the created pixmap */
  rgb_pixbuf = gdk_pixbuf_get_from_drawable(
    NULL, rgb_pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, width, height);
  rgba_pixbuf = gdk_pixbuf_add_alpha(
    rgb_pixbuf, TRUE, trans->red, trans->green, trans->blue);
  cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), rgba_pixbuf, x, y);

  return cursor;
#define gdk_cursor_new_from_pixmap fixed_gdk_cursor_new_from_pixmap

Bug 2: Loading and saving doesn’t work

Using our Windows version of Xournal to try to load a file saved by Xournal on Linux gives an error message. What’s more, a file saved with our Windows version of Xournal gives an error message when trying to load it with Xournal on either platform!

It took me quite a while to figure this out, but the culprit here is that Xournal uses zlib in the wrong way, namely with text-mode I/O instead of binary I/O. This bug doesn’t show up on Linux because there text-mode and binary I/O are pretty much the same thing. On Windows, however, text-mode I/O converts a '\n' character into "\r\n" on writing, and vice versa on reading. This is fine for text documents, but not for binary files such as Xournal’s!

The fix is simple: replace text I/O modes ("r" and "w") by binary I/O modes ("rb" and "wb") in all the relevant gzopen, popen, and fopen calls. That is, all the calls in src/xo-print.c and all the calls in src/xo-file.c except for

  f = fopen(ui.mrufile, "w");

in save_mru_list, and

  f = fopen(ui.configfile, "w");

in save_config_to_file.

Bug 3: Fullscreen isn’t truly fullscreen

When I tried Xournal’s fullscreen mode, I could still see the Windows taskbar. This seems to be a bug in the gtk_window_fullscreen function on Windows. Inkscape’s fullscreen functionality does work properly, however, and that also uses gtk_window_fullscreen. It’ll take some more detective work to pin this down properly, but in the meantime it is fairly easy to work around.

  • In src/xournal.h, add two new fields to the UIData struct:

      gint pre_fullscreen_width, pre_fullscreen_height;

  • In src/xo-callbacks.c, in the on_viewFullscreen_activate function, replace the two lines

      if (ui.fullscreen) gtk_window_fullscreen(GTK_WINDOW(winMain));
      else gtk_window_unfullscreen(GTK_WINDOW(winMain));

    by the lines

      if (ui.fullscreen) {
        gtk_window_get_size(GTK_WINDOW(winMain), &ui.pre_fullscreen_width,
        gtk_widget_set_size_request(GTK_WIDGET(winMain), gdk_screen_width(),
      } else {
        gtk_widget_set_size_request(GTK_WIDGET(winMain), -1, -1);
        gtk_window_resize(GTK_WINDOW(winMain), ui.pre_fullscreen_width,

With all of the above fixes, compiling the resulting source code gives a working version of Xournal on Windows (minus the screenshot functionality).

This entry was posted in Programming. Bookmark the permalink.

29 Responses to Xournal on Windows

  1. Paco says:

    And where is the EXE/COM file in this zip?

  2. Dirk Gerrits says:

    It’s not. This is just the source code. You can now find the Windows binaries of Xournal on its homepage at http://xournal.sourceforge.net/, since the author picked up on my work.

  3. Paco says:

    I was not be able to found those binaries at xournal.sourceforge.net. I’m not sure but the donwloable compressed file is for linux

    In fact, I use ubuntu but I’d like to get the Windows version for my partners

  4. Dirk Gerrits says:

    This is a bit confusing about the Xournal website at the moment. The topmost download link is for the Linux version, but if you look a bit down you’ll find:

    “New: Win32 binaries of version 0.4.5 are now available (experimental – use at your own risk!) (updated Nov 25, 2009)”

    This links to the latest Windows binaries.

  5. Paco says:


  6. fadumpt says:

    Will PDF annotation work on the windows version?
    I’m having a horrible time trying to find something that does that in windows.

  7. Dirk Gerrits says:

    It should work in principle, although there may be bugs. (Please report any bugs you find.)

    However, you can already do PDF annotation in Windows Journal, sort of. Windows Journal comes with a virtual printer that allows you to turn a PDF into a Windows Journal file.

  8. Stefan Mueller says:

    Thousand thanks, Dirk!
    Switching from XP Tablet Edition completely over to Ubuntu Linux had worked perfectly well for me. I have been using Xournal natively for all my note taking and PDF annotation tasks. Working on tablet PCs at work on XP however made me feel the digital divide of vendor lock-in sharply. (I had to leave all my Windows Journal notes behind as a price for the way out!) Now that the gap is filled, I can truly work cross-platform which makes my life much simpler. Thank you very, very much!
    Stefan Mueller, Switzerland

  9. Dirk Gerrits says:

    @Stefan Mueller
    Glad I could help. :) Though most of the credit of course goes to Denis Auroux for making Xournal in the first place.

    Do you still have your Windows Journal files? I used a virtual printer to turn them into PDFs, which could then be further annotated in Xournal. Not perfect, but at least not a total loss.

  10. Pietro says:

    Thanks a lot Dirk
    Now I am able to fix the icon in the Ardesia win32 porting

    I have a couples of problem about trasparency but I hope
    that can solve as soon as possible

  11. Dirk Gerrits says:

    Glad I could help. :) What transparency issues are you having?

  12. Vicent says:

    Sorry about my poor english.
    Thanks for Xournal on windows. Now we can use ink layers ! Thanks.

  13. Pietro says:

    I am not able to work with a complete transparent GtkWindow
    without that the mouse event pass below the window
    (this is the default behaviour in windows)

    At the moment in windows I am using a semitransparent window to avoid the problem
    but in the linux version I’m able to have a complete transparent window
    and color different RGBA color

    See the screenshot on http://code.google.com/p/ardesia/

    The other problem is that in the window32 gtk implementation the gdk_window_input_shape_combine_mask does not work properly.

    In linux I use this call a lot, when I want paint on the top of the transparent window I apply a NULL shape to grab the mouse events

    When you select the ungrab button I apply a transparent shape to pass the events below the transparent window

    I have seen the documentation of the gdk_window_input_shape_combine_mask function
    ant it says that in the window implementation in win32 does nothing

    but reading the code I have seen that call the gdk_window_shape_combine_mask
    that make a very different think.

    Anyway for the moment I have stopped to try to fix these two problem on win32
    because I am alone and I have a lot of work to do to maintain Ardesia
    and I have not a lot of skill in the windows environment

    I think that Ardesia will be a free good program to be used to make presentation
    or to be used with touch screen, tablet and…

    Cheers bye

  14. Dirk Gerrits says:

    Wow, Ardesia looks nice. Unfortunately, I’m no Windows expert either, and I’m afraid I can’t help you with your problem. Have you tried any mailing lists for Windows programming or Gtk+ programming?

  15. Pietro says:

    No, I have not.
    It seems that there are not many people that uses gtk under windows.

    I have not idea if it exists some specific mailing list for gtk and win.

    I’ll hope to found someone interested to fix the problems.
    Anyway I think that the right way to work is:
    - fix the GtkWindow initialization and
    - implement the gdk_window_input_shape_combine_mask
    - implement the gdk_cursor_new_from_pixmap that you have workarounded.

    I don’t think that a patch approach can allow to a serious development
    and then I think that the right way to follow is publish bug reports
    to the gtk team

    The gtk fix for win32 it is out of my planes.
    I am a free software supporter and I have tried to build Ardesia
    for windows only to see my program run on it and to demonstrate the porting feasibility.

    This task for me is closed even if I don’t know how fix some things.

    I have other priority in the development.

    I’m pretty sure that have Ardesia running with the mainstream Ubuntu distro it is more useful for my purposes.

    I have seen that the windows user often prefer shareware software and I can not think that it is easy to make visible a tool that it run under Windows.

    There are for win some tools similar to Ardesia;
    I know them (e.g. Easy Whiteboard, pointtofix…) and
    I have tried to do better and I think to have reached the goal.

    We’ll see, it is possible that the win32 porting will be postponed

    An other very interesting porting is in the MacOsX direction, for this operating system there are not similar tools and there are a lot of designers that love this platform.


  16. Pingback: Pembaca PDF : Xournal dan Nitro PDFreader – ashadinugroho.com

  17. Giorgio says:


    I’m not sure if that’s the right place to post this question but I don’t know where else. I installed xournal on my Lenovo tablet (with Windows 7) and I have some problems:
    -The handwriting is very pixelated (in MS Journal it’s smooth)
    -I cannot use the eraser tip of my stylus
    -In the options menu, the following are not highlighted: Use XInput, Eraser Tip, Pressure sensitivity

    I hope someone can help me, since if wasted more than 2 hours to find the solution
    to these problems.


    • Uwe says:

      Hello everyone,

      I have the same issue like Giorgio. I’d desparately like to use Xournal on my Windows Tablet, unfortunately the digitizer input is absolutely pixelated. The Option for Pressure sensitivity is grayed out in the Options menu. What can be done here?

      Thanks and kind regards!

  18. Andy says:

    A BIG thank you Dirk!

    I recently decided to try to go “predominantly paperless” (ie., to do all my many notes and scribbles – that I usually make when I’m thinking and planning etc – all on the PC). I looked around, and settled on a modestly-priced Wacom (Bamboo Pen) Tablet together with Xournal software. I also looked at Jarnal and NoteLab too, but I prefer Xournal. So far, it seems stable enough.

    Given that I run only Windows, I just wanted to say, “A BIG thank you Dirk!” for going to the trouble of sharing the above and making it possible for this humble non-programmer to be able to use this nifty piece of software.

    Much appreciated.

  19. Mauricio Camargo says:

    Please, where can I find the config file in Windows?

    • bronzlabec says:

      in the folder .xournal
      the folder itself is in some place of the sorts: c:/users/you_user/.xournal

      the file you need is “config” — text edit it (with notepad, if nothing else) to suit.
      (not a lot of options, although)

      hope it helps

  20. Georg Wechslberger says:

    Just in case you (or anybody else) is interested in this:
    I’ve fixed some bugs in xournal that occurred on windows systems if multiple monitors were used. The fixed source code can be found at


    and includes build instructions based on your blog entry.
    (With this page being included as the source of the instructions.)

    Thanks for porting xournal to windows!

  21. orschiro says:

    Is it possible to port an updated version of Xournal or even Xournal++?

    With the current version I’m having the problem to open bigger (more than 1MB) PDF files for annotation.

    I always get the error:

    Error opening file ‘C:\Users\User\Test.pdf’



  22. jacak says:

    it would be very nice if you make an update to this tutorial. Because i could not make it work :/

    thank you very much

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>