recovering corrupt xoj file

  • Hello all,

    I just started using xournal and one of my xoj files won't open. Are there any obvious things to check for when trying to see if the file is corrupt?


  • Denis Auroux
    Denis Auroux

    First: is the file size > 0 ?

    Does "zcat file.xoj > file-uncompressed.xoj" (or equivalent ungzipping if you're not in linux) produce what looks like a readable text file with series of numbers interspersed by occasional XML tags?

    Is the file truncated, or does it go all the way to the closing </xournal> tag?
    (if truncated, chop off at the last good </text> or </stroke>, and terminate things cleanly by adding
    </layer></page></xournal> at the end)

    If you're using the windows port, consider editing the file to search for things like "#-1J" inside there, and delete the strokes that contain faulty numbers (it's a known bug I can't fix).

    If you'd like me to have a look, e-mail the file to (my username) and I'll see what I can do.


  • Thanks very much! I was able to fix it using this.

  • sashko

    this method is real magic. I've just managed to recover a significant portion of a file with notes for a lecture, a friend of mine spend long hours working on. Nobody knows why it suddenly have become corrupted and xournal refuses to open it. Thank you so much!

  • kirti

    i am new to Linux . i had created an xoj file but saved it with an extension .txt and now it has been encrypted and i am unable to open it. i tried to revert the extension back to .xoj but then also the problem persists.. now the file shows empty but the filesize remain entact. :( Can anyone please please help me with it…. i have to recover my file……

    Thanks in advance,

  • sashko

    sonalkirti2789, the file is not encrypted but compressed . You can uncompress it by doing

    "zcat yourfile.xoj > yourfile-uncompressed.xoj"

    in terminal or using some giu uncompressing software, as auroux wrote above. Then inspect the resulting file in a text editor to see if the structure is not corrupt, and if needed fix it with closing xml elements appropriately. After that you can try to feed this file to xournal. Optionally, upload it somewhere and let me look at it if you want.