I find it inconvenient that .xoj file, if it has a pdf background, depends on
an absolute path of the original pdf file. Since I organize pdf's very
frequently, .xoj files associated with them become easily obsolete. I'm sure
many people are suffering from this behavior.
To workaround this issue, we can use the md5 sum (or some hash function) of
the pdf content to determine its associated .xoj file.
This way, if .xoj file repository is fixed (e.g. ~/.xournal/xoj/), we will be
able to get a corresponding between the two regardless of the paths of the pdf
files.
I'm quite confused - why don't you just leave the xoj file next to its pdf, in the same directory? Then you can move them both simultaneously, xournal is smart enough to find the PDF file if it's next to the xoj. (at least in 0.4.5; you should upgrade if you haven't done so already).
In any case your proposal to use md5 sums and a central repository seems very complicated. Not to mention that, in my typical use scenarios, I often have one pdf file with many xoj files annotating it, so when I open a pdf file in xournal, I really want the pdf, not one set of annotations chosen at random. If I wanted the annotations, I'd open the xoj, not the pdf.
(I do realize that you're visibly using xournal as a tool to maintain annotations on a library of PDF files; this is pretty different from the needs of people who use xournal as a notetaking tool and may have PDF templates of paper to write on. In any case I think keeping the PDF and the xoj in the same directory should be an easier solution to almost everyone's needs?).
Denis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see. So the Xournal ontology between you and I seems to be very
much different. I never found myself using multiple .xoj for the
same pdf. You are quite right that I'm using xournal as an
annotator to maintain annotations on a library of pdf files. In
fact, I regard it as something like Amazon Kindle with more
interactive features: a book reader and a book annotator. Under
this ontology, it makes more (intuitive) sense to have a 1-1
correspondence between pdf (book) and xoj (annotation), in which
case it is convenient to have a feature such as the one I
suggested.
I do place .xoj under the same directory as its pdf file. In my
case, "inconvenience" appears in situations where e.g.
• you try to change the name of the original pdf (in which case
you'd have to zcat .xoj and do a sed substitution for the stored
pdf filename).
• you'd like to move the location of a pdf (as you also would
have to move its .xoj along with it. this may sound easy enough,
but easily becomes tedius for a huge pdf collection).
• you'd like to keep the pdf directory clean (it's a bit
distracting to see .xoj under each pdf when doing "ls" or on a
file manager; also, when deleting pdf, it becomes another work to
delete its xoj.)
• the target pdf is accessed through symlinks.
But, based on your comment and the way xournal loads pdf
backgrounds, I kind of gather that Xournal's primary focus is to
fulfill notetaking purposes. If so, I probably should back off a
bit, though it would be very nice to have a ./configure option
that switches between notetaking and ebook-reading mode. I still
think the proposal in comment 1 is pretty straight-forward and
benefits users who prefer keeping only one .xoj for a pdf though;
and it does not break xournal's role as a notetaking tool: if a
user executes "xournal note.xoj", then let it just open a plain
xournal without pdf background. In the meantime, maybe I should
just keep working on creating patches for "book-reading" mode (like
bookmarking, lateral page loading, single key <-> action mapping, etc ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see. You do have a valid point. Added to my (lengthy) to-do list. (If you have any inclination to do so, feel free to write some patches that will make things better for you, as I'm usually pretty slow at coding things…)
Denis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I find it inconvenient that .xoj file, if it has a pdf background, depends on
an absolute path of the original pdf file. Since I organize pdf's very
frequently, .xoj files associated with them become easily obsolete. I'm sure
many people are suffering from this behavior.
To workaround this issue, we can use the md5 sum (or some hash function) of
the pdf content to determine its associated .xoj file.
This way, if .xoj file repository is fixed (e.g. ~/.xournal/xoj/), we will be
able to get a corresponding between the two regardless of the paths of the pdf
files.
An Illustration:
1. user executes
$ xournal Matplotlib.pdf
2. xournal calculates md5(Matplotlib.pdf): 5bb4eeba7e8d86c6e129a80c169f3ab9
3. xournal looks up its mapping file: ~/.xournal/md5sums
Xournal finds the entry
5bb4eeba7e8d86c6e129a80c169f3ab9 ~/.xournal/xoj/Matplotlib.pdf.xoj
4. xournal opens ~/.xournal/xoj/Matplotlib.pdf.xoj
5. xournal sets Matplotlib.pdf as background as it does normally.
This works better because .pdf content usually wouldn't change (or if it did
at all, less frequent its path being changed).
I use xournal every day, and I'm one of the "many people are suffering from this behavior."
I think the proposal is excellent, though I would go a step further and bundle the pdf with the xoj.
I'm quite confused - why don't you just leave the xoj file next to its pdf, in the same directory? Then you can move them both simultaneously, xournal is smart enough to find the PDF file if it's next to the xoj. (at least in 0.4.5; you should upgrade if you haven't done so already).
In any case your proposal to use md5 sums and a central repository seems very complicated. Not to mention that, in my typical use scenarios, I often have one pdf file with many xoj files annotating it, so when I open a pdf file in xournal, I really want the pdf, not one set of annotations chosen at random. If I wanted the annotations, I'd open the xoj, not the pdf.
(I do realize that you're visibly using xournal as a tool to maintain annotations on a library of PDF files; this is pretty different from the needs of people who use xournal as a notetaking tool and may have PDF templates of paper to write on. In any case I think keeping the PDF and the xoj in the same directory should be an easier solution to almost everyone's needs?).
Denis
Denis,
I see. So the Xournal ontology between you and I seems to be very
much different. I never found myself using multiple .xoj for the
same pdf. You are quite right that I'm using xournal as an
annotator to maintain annotations on a library of pdf files. In
fact, I regard it as something like Amazon Kindle with more
interactive features: a book reader and a book annotator. Under
this ontology, it makes more (intuitive) sense to have a 1-1
correspondence between pdf (book) and xoj (annotation), in which
case it is convenient to have a feature such as the one I
suggested.
I do place .xoj under the same directory as its pdf file. In my
case, "inconvenience" appears in situations where e.g.
• you try to change the name of the original pdf (in which case
you'd have to zcat .xoj and do a sed substitution for the stored
pdf filename).
• you'd like to move the location of a pdf (as you also would
have to move its .xoj along with it. this may sound easy enough,
but easily becomes tedius for a huge pdf collection).
• you'd like to keep the pdf directory clean (it's a bit
distracting to see .xoj under each pdf when doing "ls" or on a
file manager; also, when deleting pdf, it becomes another work to
delete its xoj.)
• the target pdf is accessed through symlinks.
But, based on your comment and the way xournal loads pdf
backgrounds, I kind of gather that Xournal's primary focus is to
fulfill notetaking purposes. If so, I probably should back off a
bit, though it would be very nice to have a ./configure option
that switches between notetaking and ebook-reading mode. I still
think the proposal in comment 1 is pretty straight-forward and
benefits users who prefer keeping only one .xoj for a pdf though;
and it does not break xournal's role as a notetaking tool: if a
user executes "xournal note.xoj", then let it just open a plain
xournal without pdf background. In the meantime, maybe I should
just keep working on creating patches for "book-reading" mode (like
bookmarking, lateral page loading, single key <-> action mapping, etc ;)
I see. You do have a valid point. Added to my (lengthy) to-do list. (If you have any inclination to do so, feel free to write some patches that will make things better for you, as I'm usually pretty slow at coding things…)
Denis