Comments (5)
repo: https://github.com/freder/bindery-bug-report
from bindery.
Hi @freder, sorry this is poorly documented, but it is expected behavior that eachPage is called multiple times during rendering.
(This is what powers features like the table of contents— at the beginning of the book, we aren't sure what page number a certain section will land on. So every time the book changes, we let the other pages know so that they can update. What that means is any changes you make in a custom rule must be resilient to being called multiple times.)
bindery/src/rules/PageReference.ts
Lines 113 to 120 in b946d63
from bindery.
@evnbr ok, cool. – wasn't sure if this is intended behavior or not.
(This is what powers features like the table of contents— at the beginning of the book, we aren't sure what page number a certain section will land on. So every time the book changes, we let the other pages know so that they can update. What that means is any changes you make in a custom rule must be resilient to being called multiple times.)
does that mean any change a rule makes triggers a 're-layout'? because when I tried resizing / positioning images in a custom rule, it seemed like text flow / layout was already done by the time my rule was executed.
is there a (high-level) description of how layout / rendering works?
from bindery.
As it currently stands, no rule can 'trigger a relayout'— sizes must be determined up-front. So the table of contents, for example, will first insert a placeholder element with an estimated size, and in the eachPage callback it will update the page number and assume it will still fit.
I suspect what you want to do is hook in earlier in the layout process using beforeAdd/afterAdd, as seen here, but those details are undocumented and probably difficult to use.
is there a (high-level) description of how layout / rendering works?
Great question— not yet, right now it's a bit spaghetti. I have a refactor in-progress that I believe will provide much clearer hooks for what you are trying to do here, presumably something like a "page float" as described in #84 . That work is going to happen in the next version of the pagination library (https://github.com/evnbr/regionize), with the plan that bindery will provide an easy / more declarative api for page floats on top of it. Will write something up when I get a chance!
from bindery.
thx 👍
from bindery.
Related Issues (20)
- blank page for every second page with paper A4 landscape HOT 1
- automatically set paper size from layout
- add linear mode = single page + zoom to fit width HOT 2
- Overflowing HOT 1
- Print -> empty pages are added between pages HOT 1
- conflict with bootstrap HOT 1
- print spreads with first side left
- booklet: print center line as sowing guide HOT 1
- restore scroll position after page reload
- cant select text in "print preview" mode HOT 1
- running header ignores top margin HOT 1
- incremental rendering in development mode HOT 1
- flipbook view should be less fancy
- print button should be disabled while layout is rendering
- mention similar projects in readme HOT 1
- Return result instead of render HOT 3
- PDF contains extra blank pages at the beginning and end HOT 1
- Issue with columns
- aria labels for control buttons
- Possibility of toggling controls, or even run Bindery in a Flipbook only mode? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bindery.