Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix: #3 page label bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Jul 16, 2022
1 parent fb15617 commit 51ce537
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addon/chrome/content/previewPDF.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,19 @@
);
let lastNumber =
pdf.numPages > maxPageNum ? maxPageNum : pdf.numPages;
let pageLabels =
(await pdf.getPageLabels()) ||
// Create page lables equals to page indices
[...Array(lastNumber)].map((e, i) => String(1 + i));
for (i = 1; i <= lastNumber; i++) {
if (id !== itemID) {
// Stop current render if there is a new item
console.log(id, itemID, "Eraly stop rendering");
break;
}
// page index starts from 1
const currentAnnotations = annotations.filter(
(annot) => Number(annot.pageLabel) === i
(annot) => annot.pageLabel === pageLabels[i - 1]
);
console.log(annotations, currentAnnotations);
canvas = document.createElement("canvas");
Expand Down

0 comments on commit 51ce537

Please sign in to comment.