Ng2-pdf-viewer: Regression: Version 5.2 Broke (page-rendered)

Created on 6 Nov 2018  路  7Comments  路  Source: VadimDez/ng2-pdf-viewer

Bug Report or Feature Request (mark with an 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.

bug

All 7 comments

(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.

https://stackblitz.com/edit/ng2-pdf-viewer-q3tiib

The (page-rendered) event is correctly triggered but the (text-layer-rendered) not is still not triggered on page change.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xmran picture xmran  路  4Comments

roginneil picture roginneil  路  3Comments

quentinmachard-niji picture quentinmachard-niji  路  3Comments

VadimDez picture VadimDez  路  5Comments

manojbhardwaj picture manojbhardwaj  路  7Comments