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") {
|
||||
for (let i = 0; i < voca_list.length; ++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 (page) {
|
||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||
}
|
||||
pdfUrlList = [];
|
||||
page = pdfDoc.addPage();
|
||||
|
||||
yCursor = 1;
|
||||
col = -1;
|
||||
}
|
||||
@@ -155,16 +155,20 @@ export async function makePdf(
|
||||
blind: true,
|
||||
});
|
||||
yCursor++;
|
||||
|
||||
if (page && data === pageLastItem) {
|
||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 답 생성
|
||||
for (let i = 0; i < voca_list.length; ++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 (page) {
|
||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||
}
|
||||
pdfUrlList = [];
|
||||
page = pdfDoc.addPage();
|
||||
yCursor = 1;
|
||||
@@ -186,6 +190,10 @@ export async function makePdf(
|
||||
blind: false,
|
||||
});
|
||||
yCursor++;
|
||||
|
||||
if (page && data === pageLastItem) {
|
||||
page.node.set(PDFName.of("Annots"), pdfDoc.context.obj(pdfUrlList));
|
||||
}
|
||||
}
|
||||
|
||||
const pdfBytes = await pdfDoc.save();
|
||||
|
||||
Reference in New Issue
Block a user