Merge pull request #96 from Sf298/main

Fixed rotate all button not working
This commit is contained in:
Anthony Stirling 2023-04-20 18:29:12 +01:00 committed by GitHub
commit 71636c3413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -263,6 +263,7 @@
function rotateAll(deg) { function rotateAll(deg) {
for (var i=0; i<pagesContainer.childNodes.length; i++) { for (var i=0; i<pagesContainer.childNodes.length; i++) {
const img = pagesContainer.childNodes[i].querySelector("img"); const img = pagesContainer.childNodes[i].querySelector("img");
if (!img) continue;
rotateElement(img, deg) rotateElement(img, deg)
} }
} }
@ -271,6 +272,7 @@
const pdfDoc = await PDFLib.PDFDocument.create(); const pdfDoc = await PDFLib.PDFDocument.create();
for (var i=0; i<pagesContainer.childNodes.length; i++) { for (var i=0; i<pagesContainer.childNodes.length; i++) {
const img = pagesContainer.childNodes[i].querySelector("img"); const img = pagesContainer.childNodes[i].querySelector("img");
if (!img) continue;
const pages = await pdfDoc.copyPages(img.doc, [img.pageIdx]) const pages = await pdfDoc.copyPages(img.doc, [img.pageIdx])
const page = pages[0]; const page = pages[0];