-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Dynamic page margins #1746
base: 0.1
Are you sure you want to change the base?
Dynamic page margins #1746
Conversation
Tab indents instead of spaces (using indents based on source)
^ I'll have a look at the tests. |
@seahorsepip I would like to achieve the following;
|
Do you have solution for this issue , please provide the updates on this. |
These merge conflicts seem pretty small. |
@seahorsepip It should but doesn't seem to work with horizontal margins, strangely enough. // left, top, right, bottom
pageMargins: currentPage => [100, ((currentPage % 2 === 1) ? 0 : 100), 100, 100], // OK
pageMargins: currentPage => [((currentPage % 2 === 1) ? 0 : 100), 100, 100, 100], // doesn't work Ditto with // horizontal, vertical
pageMargins: currentPage => [100, ((currentPage % 2 === 1) ? 0 : 100)], // works
pageMargins: currentPage => [((currentPage % 2 === 1) ? 0 : 100), 100], // doesn't Would love your input as well @liborm85 . |
This is especially strange since we have already adjusted the this.pageSnapshot().availableWidth =
this.getCurrentPage().pageSize.width -
this.getCurrentPage().pageMargins.left -
this.getCurrentPage().pageMargins.right; |
@liborm85 Have you taken a look at my examples? Thanks very much! |
Sorry for the late reply, haven't looked at this MR (literally) for years. I saw this comment about the horizontal margins: #368 (comment) |
@seahorsepip I believe I have tried that before
I have seen this comment as well but it does not work (see my second comment). |
@lieuzhenghong this.pageSnapshot().availableWidth =
this.getCurrentPage().pageSize.width -
this.getCurrentPage().pageMargins(* page nr *).left -
this.getCurrentPage().pageMargins(* page nr *).right; |
Has anyone found a solution for this? |
This function will receive the pageNumber as argument. This commit is a port of original work of @seahorsepip in pull request bpampuch#1746 This rework is rebuild on 0.3 version, it adds some unit tests for new helpers and it has integration tests following comments in original pull request bpampuch#1746.
This function will receive the pageNumber as argument. This commit is a port of original work of @seahorsepip in pull request bpampuch#1746 This rework is rebuild on 0.3 version, it adds some unit tests for new helpers and it has integration tests following comments in original pull request bpampuch#1746.
Makes document definition pageMargins dynamic (based on current page):
Non dynamic page margins are still supported:
Changes have been based on comments from Issue 368 with some additonal changes: