Skip to content

Commit

Permalink
Merge pull request #114 from VadimDez/features/#111
Browse files Browse the repository at this point in the history
Fixes #111, load pages synchronously to keep order
  • Loading branch information
VadimDez authored Jul 31, 2017
2 parents f5f7228 + 7fd7f80 commit 2fb6076
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pdf-viewer/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ export class PdfViewerComponent implements OnChanges {

this.removeAllChildNodes(container);

for (let page = 1; page <= this._pdf.numPages; page++) {
this.renderPage(page);
}
// render pages synchronously
const render = (page: number) => {
this.renderPage(page).then(() => {
if (page < this._pdf.numPages) {
render(page + 1);
}
});
};

render(1);
}

private isValidPageNumber(page: number) {
Expand Down

0 comments on commit 2fb6076

Please sign in to comment.