Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof-of-concept for auto-trimming of page margins #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robamler
Copy link

(Please note that I'm new to github. I'm not sure if a pull request is the correct way to notify about a half-baked new feature on a topic branch.)

This implementation follows the second approach outlined in #issuecomment-5596872 (see issue #20). Auto-trimming can be turned on and off with the boolean field PDFPageView.autoTrimOn, which, for now, is just a static constant.

Things that remain to be done:

  • I'm not sure if this implementation is memory efficient. Maybe we could do with copying the image one less time.
  • Coordinate transformation for forward/backward search and for annotations.
  • Correct handling of the "fit page to screen" and "fit page width to screen width" zoom actions.
  • Front end to turn auto-trimming on and off (toggle button).

robamler added 3 commits May 10, 2012 23:28
This implementation follows the second approach outlined
in #issuecomment-5596872 (see issue Borisvl#20 on github.com/Borisvl/
Pdf4Eclipse). Auto-trimming can be turned on and of with the
boolean field PDFPageView.autoTrimOn, which, for now, is just
a static constant.

Things that remain to do:

 - I'm not sure if this implementation is memory efficient.
   Maybe we could do with copying the image one less time.

 - Coordinate transformation for forward/backward search and
   for annotations.

 - Correct handling of the "fit page to screen" and "fit page
   width to screen width" zoom actions.

 - Frontend to turn auto-trimming on and off (toggle button).
Finish implementation of auto-trimming of page margins.
Detailed list of changes compared to previous commit:

 - Add front end (toolbar button).

 - Fix coordinate transformations for annotations and for
   synctex forward/backward search.

 - Fix behaviour of the "fit page to screen" and "fit page
   width to screen width" commands when auto-trimming is
   activated.
With the previous implementation, fitting the page width to the
screen width sometimes resulted in a page width that was actually
one pixel *larger* than the screen width. This was due the use
of Math.round(). This commit should fix this issue by always
rounding _down_ the would-be floating point page dimensions to
the integer page dimensions.
@robamler
Copy link
Author

Hi Boris,
This implementation works well on my machine. Please let me know if you find any bugs or would like to have anything refactored.
Robert

@Borisvl
Copy link
Owner

Borisvl commented May 14, 2012

Hi, thank you very much for your effort. I will take a closer look at it in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants