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

adding after-render-complete emitter #265

Closed
1 of 4 tasks
ghost opened this issue Jan 31, 2018 · 3 comments
Closed
1 of 4 tasks

adding after-render-complete emitter #265

ghost opened this issue Jan 31, 2018 · 3 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Jan 31, 2018

  • 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

Hi, I really need to catch the moment when the DOM is fully created. In fact, I looked in the code and found an interesting place to add the eventEmitter.

  • The first when we have to make several pages
  • The second when rendering a page.

Proposal:
For the rendering of a page, I put it in the renderPage function just before the return

PdfViewerComponent.prototype.renderPage = function (pageNumber) {
      // ...
        this._pdf.getPage(pageNumber).then(function (page) {
           /* ... */
            pdfPageView.setPdfPage(page);
          _this.afterRenderComplete.emit(true); // --> here
          return pdfPageView.draw();
        });
    };

For rendering multiple pages, I had to put it in the updateSize function right after the pdfViewer._setScale function to be sure to have all the pages rendered.

PdfViewerComponent.prototype.updateSize = function () {
        /* ... */
        this._pdf.getPage(this.pdfViewer.currentPageNumber).then(function (page) {
           /* ... */
            }
            _this.pdfViewer._setScale(scale, stickToPage);
            _this.afterRenderComplete.emit(true); // --> here
        });
    };

Like that, I can know when the DOM is created and i can manipulate it by catching the eventEmitter in the component.

<pdf-viewer [src]="pdfSrc" [show-all]="true" (after-render-complete)="stateRender($event)"></pdf-viewer>

thanks in advance for your reply.

@VadimDez VadimDez self-assigned this Feb 10, 2018
@VadimDez VadimDez added this to the 4.1.0 milestone Feb 10, 2018
@VadimDez
Copy link
Owner

relates to #81

VadimDez added a commit that referenced this issue Feb 10, 2018
VadimDez added a commit that referenced this issue Feb 10, 2018
@VadimDez
Copy link
Owner

@dinakarvedi
Copy link

Hi VadimDez, in my application i have mutliple page pdf's approximately upto 1000 pages how can i reduce the time to load the pdf's as fast as i can or else is there any chance of getting first ten pages in the inital page load and load rest of the pages

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

No branches or pull requests

2 participants