x)- [X] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request
The docs state
"Get event when a page is rendered. Called for every page rendered."
This used to be the case but no longer functions that way. Now if you use [page]='pdfPageNumber' to increment the page number this callback is never recalled.
(page-rendered) is working when [show-all] is true but not when [show-all] is false
Tested here: https://vadimdez.github.io/ng2-pdf-viewer/
So we will no longer be able to use [show-all]='false' and page-rendered to capture each page of the pdf individually?
I've just tried in the latest version and it seems to be working. When you set [show-all]="false" (page-rendered) is called on the first render but not the second. Not sure if that covers your use case. Otherwise you could use something like this:
window.addEventListener('pagechange', (e) => console.log(e));
That is not how it worked one version ago though. Was there a reason it needed to change? Before (page-rendered) would be called everytime a new pdf page was loaded into the pdf viewer. Now that functionality has stopped working when you have [show-all]="false"
There were several changes related to how single page is rendered. PDFSinglePageViewer and custom event bus are now used.
Same issue for (text-layer-rendered) as it is triggered in the same way as (page-rendered).
For those who would like to test...
Here is a stackblitz where page-rendered and text-layer-rendered events are console logged.
Load a local PDF then click several times on the Next page button.
Events are not triggered at each page change.
The (page-rendered) event is correctly triggered but the (text-layer-rendered) not is still not triggered on page change.