#53 resizing paper without rescaling background

open
nobody
None
5
2013-10-02
2010-05-16
No

This adds a new option in the "paper size" dialog box to keep bitmap or PDF backgrounds at their original size regardless of the paper size: so enlarging the page creates a white margin (potentially useful for annotations).

The patch applies against the current CVS code base (as of May 16 2010).
The code was written somewhat hastily and I am not sure if this is production quality -- please test carefully. One issue I'm aware of: depending on config file settings, different copies of xournal may have different ideas of what "original size" means for a bitmap background, i.e. may scale the background differently within the page (please comment on whether this is a significant issue).

The file format extension should be backward compatible -- versions of xournal without the patch will simply expand the background to fill the entire page instead of showing white margins around it.

Denis

Discussion

  • Denis Auroux

    Denis Auroux - 2010-05-16

    Note: the config file (after saving preferences) will contain a new line "bg_noresize = false", set it to true if you'd like the optional behavior to become the default when annotating a PDF file.

     
  • Denis Auroux

    Denis Auroux - 2010-05-16
    • summary: resizing paper does not rescale background --> resizing paper without rescaling background
     
  • Ivan Perez-Dominguez

    Denis, this sounds like a very useful feature. So far I've had to using a bash script that takes any pdf and adds a white page next to it for margin notes.

    Do you think this could be included in the mainstream version of xournal in the short-term?

     
  • Denis Auroux

    Denis Auroux - 2010-11-11

    I think this still needs some more work, and time is scarce at the moment... so no promises :(

     
  • philip_rhoades

    philip_rhoades - 2010-11-11

    Denis,

    I did:

    cvs -d:pserver:anonymous@xournal.cvs.sourceforge.net:/cvsroot/xournal login
    cvs -z3 -d:pserver:anonymous@xournal.cvs.sourceforge.net:/cvsroot/xournal co -P xournal
    autogen.sh
    make

    but I don't get an executable that has the "Keep background at original size" checkbox . .

    Thanks,

    Phil.

     
  • Nobody/Anonymous

    Phil, you have to apply the patch, and most likely, you'll need to checkout the version of the repository as of May 16 2010.

    I don't remember the specific syntax in cvs, the command may be update -D 20100516. After that, download and apply the patch, and see if it works that way.

     
  • Ivan Perez-Dominguez

    I tried what I said in the previous comment (update + patch) but I was unable to apply the patch. My best results were with a high fuzzy factor, but not all files were patched.

    $ patch -u -F 3 --dry-run < ../noresize_background_v1.patch
    patching file ChangeLog
    Hunk #1 succeeded at 5 with fuzz 2.
    patching file xo-callbacks.c
    Hunk #1 succeeded at 444 with fuzz 3 (offset -1 lines).
    Hunk #2 FAILED at 498.
    Hunk #3 succeeded at 658 with fuzz 3 (offset -2 lines).
    Hunk #4 FAILED at 707.
    Hunk #5 succeeded at 1236 with fuzz 3 (offset -3 lines).
    Hunk #6 succeeded at 1260 with fuzz 3 (offset -4 lines).
    Hunk #7 succeeded at 1272 with fuzz 3 (offset -5 lines).
    Hunk #8 FAILED at 1299.
    Hunk #9 FAILED at 1531.
    Hunk #10 FAILED at 1578.
    Hunk #11 FAILED at 2940.
    Hunk #12 succeeded at 3077 with fuzz 3 (offset -6 lines).
    Hunk #13 succeeded at 3587 with fuzz 3 (offset -7 lines).
    6 out of 13 hunks FAILED -- saving rejects to file xo-callbacks.c.rej
    patching file xo-callbacks.h
    Hunk #1 succeeded at 631 with fuzz 3 (offset -1 lines).
    patching file xo-file.c
    Hunk #1 succeeded at 167 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 289 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 432 with fuzz 3 (offset -3 lines).
    Hunk #4 succeeded at 1053 with fuzz 3 (offset -4 lines).
    Hunk #5 succeeded at 1373 with fuzz 3 (offset -5 lines).
    Hunk #6 succeeded at 1574 with fuzz 3 (offset -6 lines).
    Hunk #7 succeeded at 1920 with fuzz 3 (offset -7 lines).
    patching file xo-interface.c
    Hunk #1 succeeded at 2817 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 2878 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 2907 with fuzz 3 (offset -3 lines).
    Hunk #4 succeeded at 2922 with fuzz 3 (offset -4 lines).
    patching file xo-misc.c
    Hunk #1 succeeded at 78 with fuzz 3 (offset -1 lines).
    Hunk #2 FAILED at 548.
    Hunk #3 FAILED at 608.
    Hunk #4 FAILED at 659.
    3 out of 4 hunks FAILED -- saving rejects to file xo-misc.c.rej
    patching file xo-print.c
    Hunk #1 FAILED at 539.
    Hunk #2 FAILED at 570.
    Hunk #3 FAILED at 732.
    Hunk #4 FAILED at 744.
    Hunk #5 FAILED at 1258.
    Hunk #6 FAILED at 1458.
    Hunk #7 FAILED at 1466.
    7 out of 7 hunks FAILED -- saving rejects to file xo-print.c.rej
    patching file xo-shapes.h
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file xo-shapes.h.rej
    patching file xournal.h
    Hunk #1 succeeded at 60 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 199 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 294 with fuzz 3 (offset -3 lines).
    Hunk #4 FAILED at 321.
    Hunk #5 succeeded at 339 with fuzz 3 (offset -4 lines).
    1 out of 5 hunks FAILED -- saving rejects to file xournal.h.rej
    patching file xournal.glade
    dash@dash-desktop:~/tmp/xournal$ patch -u -F 3 --dry-run < ../noresize_background_v1.patch
    patching file ChangeLog
    Hunk #1 succeeded at 5 with fuzz 2.
    patching file xo-callbacks.c
    Hunk #1 succeeded at 444 with fuzz 3 (offset -1 lines).
    Hunk #2 FAILED at 498.
    Hunk #3 succeeded at 658 with fuzz 3 (offset -2 lines).
    Hunk #4 FAILED at 707.
    Hunk #5 succeeded at 1236 with fuzz 3 (offset -3 lines).
    Hunk #6 succeeded at 1260 with fuzz 3 (offset -4 lines).
    Hunk #7 succeeded at 1272 with fuzz 3 (offset -5 lines).
    Hunk #8 FAILED at 1299.
    Hunk #9 FAILED at 1531.
    Hunk #10 FAILED at 1578.
    Hunk #11 FAILED at 2940.
    Hunk #12 succeeded at 3077 with fuzz 3 (offset -6 lines).
    Hunk #13 succeeded at 3587 with fuzz 3 (offset -7 lines).
    6 out of 13 hunks FAILED -- saving rejects to file xo-callbacks.c.rej
    patching file xo-callbacks.h
    Hunk #1 succeeded at 631 with fuzz 3 (offset -1 lines).
    patching file xo-file.c
    Hunk #1 succeeded at 167 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 289 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 432 with fuzz 3 (offset -3 lines).
    Hunk #4 succeeded at 1053 with fuzz 3 (offset -4 lines).
    Hunk #5 succeeded at 1373 with fuzz 3 (offset -5 lines).
    Hunk #6 succeeded at 1574 with fuzz 3 (offset -6 lines).
    Hunk #7 succeeded at 1920 with fuzz 3 (offset -7 lines).
    patching file xo-interface.c
    Hunk #1 succeeded at 2817 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 2878 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 2907 with fuzz 3 (offset -3 lines).
    Hunk #4 succeeded at 2922 with fuzz 3 (offset -4 lines).
    patching file xo-misc.c
    Hunk #1 succeeded at 78 with fuzz 3 (offset -1 lines).
    Hunk #2 FAILED at 548.
    Hunk #3 FAILED at 608.
    Hunk #4 FAILED at 659.
    3 out of 4 hunks FAILED -- saving rejects to file xo-misc.c.rej
    patching file xo-print.c
    Hunk #1 FAILED at 539.
    Hunk #2 FAILED at 570.
    Hunk #3 FAILED at 732.
    Hunk #4 FAILED at 744.
    Hunk #5 FAILED at 1258.
    Hunk #6 FAILED at 1458.
    Hunk #7 FAILED at 1466.
    7 out of 7 hunks FAILED -- saving rejects to file xo-print.c.rej
    patching file xo-shapes.h
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file xo-shapes.h.rej
    patching file xournal.h
    Hunk #1 succeeded at 60 with fuzz 3 (offset -1 lines).
    Hunk #2 succeeded at 199 with fuzz 3 (offset -2 lines).
    Hunk #3 succeeded at 294 with fuzz 3 (offset -3 lines).
    Hunk #4 FAILED at 321.
    Hunk #5 succeeded at 339 with fuzz 3 (offset -4 lines).
    1 out of 5 hunks FAILED -- saving rejects to file xournal.h.rej
    patching file xournal.glade

     
  • philip_rhoades

    philip_rhoades - 2010-11-12

    idominguez,

    I realised I misread a previous note - I thought it was a note from Denis that the code was now in the main trunk - I still have the old code and patch and that binary still works fine . .

    Phil.

     
  • Nobody/Anonymous

    I see. No harm done :)

    First, I pasted the result of calling 'patch' twice. Sorry about that.

    Second, I could not apply the patch. Which revision of the repo are you using and how are you applying the patch?
    I'd love to test this feature, but I haven't been able to produce a working binary yet.

    -- Ivan

     
  • Ivan Perez-Dominguez

    Got it. Gave it a quick try and it works great.

    I'll report back once I've tried it for a little longer.

     
  • Elliott Sales de Andrade

    I've rebased this patch to the latest release (OK, so git did most of the work). But there are still the FIXMEs that I didn't touch.

    A couple of points:
    1. When enabling this option, the PDF page is not resized, but it still appears blurry (probably from being passed through some scaler code). Fortunately, it still comes out OK in the PDF.
    2. It would be nice to specify where the PDF background is located. I don't want it centred; I want it on the left so I can add comments on the right. Maybe with an RTL language, someone would want the opposite. I guess Left, Centre, Right are enough alignment options, though if the background could be moved like any other object, that would cover everything (but might be a bit complicated).

     

Log in to post a comment.