Skip to content

Commit

Permalink
Fixes #111, load pages synchronously to keep order
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimDez committed Jul 30, 2017
1 parent f5f7228 commit 7fd7f80
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 7fd7f80

Please sign in to comment.