Replace absolute paths of Xournal++ PDF backgrounds with relative ones.
Go to file
2021-12-18 21:41:45 +01:00
.gitignore add .gitignore 2021-10-02 20:31:50 +02:00
README.md skip non .xopp files; recursively add files from selected directory 2021-12-18 21:26:07 +01:00
relative-xopp-background add support for Nemo file manager 2021-12-18 21:41:45 +01:00

Relative Xournal++ background paths

Replace absolute paths of Xournal++ PDF backgrounds with relative ones.

Installation

Place relative-xopp-background in ~/.local/share/nautilus/scripts/relative-xopp-background and make it executable.

If missing, install notify2 and (optionally) dbus-python with your package manager or with pip.

Details

Here is an excerpt of a Xournal++ document /home/user/notes/note1/paper.pdf.xopp:

<?xml version="1.0" standalone="no"?>
<xournal creator="Xournal++ 1.1.0" fileversion="4">
    <title>Xournal++ document - see https://github.com/xournalpp/xournalpp</title>
    <!-- ... -->
    <page width="595.27600000" height="841.89000000">
        <background type="pdf" domain="absolute"
                    filename="/home/user/Documents/paper.pdf" pageno="1ll"/>
    <!-- ... -->
    </page>
    <!-- ... -->
</xournal>

If /home/user/notes/note1/paper.pdf is accessible (in the same folder as the Xournal++ file), then the absolute path will be replaced with a path relative one:

<?xml version="1.0" standalone="no"?>
<xournal creator="Xournal++ 1.1.0" fileversion="4">
    <title>Xournal++ document - see https://github.com/xournalpp/xournalpp</title>
    <!-- ... -->
    <page width="595.27600000" height="841.89000000">
        <background type="pdf" domain="absolute"
                    filename="paper.pdf" pageno="1ll"/>
    <!-- ... -->
    </page>
    <!-- ... -->
</xournal>