mirror of
https://github.com/vbalien/voca.git
synced 2025-12-06 11:26:21 +09:00
fix bug
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -129,13 +129,13 @@ export async function makePdf(
|
|||||||
if (type === "TEST") {
|
if (type === "TEST") {
|
||||||
for (let i = 0; i < voca_list.length; ++i) {
|
for (let i = 0; i < voca_list.length; ++i) {
|
||||||
const data = voca_list[i];
|
const data = voca_list[i];
|
||||||
|
const pageLastItem =
|
||||||
|
voca_list.at((perPage * (Math.floor(i / perPage) + 1)) - 1) ??
|
||||||
|
voca_list.at(-1);
|
||||||
|
|
||||||
if (i % perPage === 0) {
|
if (i % perPage === 0) {
|
||||||
if (page) {
|
|
||||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
|
||||||
}
|
|
||||||
pdfUrlList = [];
|
pdfUrlList = [];
|
||||||
page = pdfDoc.addPage();
|
page = pdfDoc.addPage();
|
||||||
|
|
||||||
yCursor = 1;
|
yCursor = 1;
|
||||||
col = -1;
|
col = -1;
|
||||||
}
|
}
|
||||||
@@ -155,16 +155,20 @@ export async function makePdf(
|
|||||||
blind: true,
|
blind: true,
|
||||||
});
|
});
|
||||||
yCursor++;
|
yCursor++;
|
||||||
|
|
||||||
|
if (page && data === pageLastItem) {
|
||||||
|
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 답 생성
|
// 답 생성
|
||||||
for (let i = 0; i < voca_list.length; ++i) {
|
for (let i = 0; i < voca_list.length; ++i) {
|
||||||
const data = voca_list[i];
|
const data = voca_list[i];
|
||||||
|
const pageLastItem =
|
||||||
|
voca_list.at((perPage * (Math.floor(i / perPage) + 1)) - 1) ??
|
||||||
|
voca_list.at(-1);
|
||||||
if (i % perPage === 0) {
|
if (i % perPage === 0) {
|
||||||
if (page) {
|
|
||||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
|
||||||
}
|
|
||||||
pdfUrlList = [];
|
pdfUrlList = [];
|
||||||
page = pdfDoc.addPage();
|
page = pdfDoc.addPage();
|
||||||
yCursor = 1;
|
yCursor = 1;
|
||||||
@@ -186,6 +190,10 @@ export async function makePdf(
|
|||||||
blind: false,
|
blind: false,
|
||||||
});
|
});
|
||||||
yCursor++;
|
yCursor++;
|
||||||
|
|
||||||
|
if (page && data === pageLastItem) {
|
||||||
|
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pdfBytes = await pdfDoc.save();
|
const pdfBytes = await pdfDoc.save();
|
||||||
|
|||||||
Reference in New Issue
Block a user