Upload 9 files
Browse files
App.tsx
CHANGED
|
@@ -393,13 +393,16 @@ const App: React.FC = () => {
|
|
| 393 |
const newPdf = await PDFDocument.create();
|
| 394 |
const { width, height } = originalPdf.getPage(0).getSize();
|
| 395 |
|
| 396 |
-
//
|
| 397 |
const reorderedPages: (number | 'BLANK')[] = [];
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
|
|
|
|
|
|
|
|
|
| 403 |
}
|
| 404 |
|
| 405 |
setProgress(40);
|
|
@@ -642,4 +645,4 @@ const App: React.FC = () => {
|
|
| 642 |
);
|
| 643 |
};
|
| 644 |
|
| 645 |
-
export default App;
|
|
|
|
| 393 |
const newPdf = await PDFDocument.create();
|
| 394 |
const { width, height } = originalPdf.getPage(0).getSize();
|
| 395 |
|
| 396 |
+
// Imposition logic to create the print-ready page sequence for booklet printing.
|
| 397 |
const reorderedPages: (number | 'BLANK')[] = [];
|
| 398 |
+
const n = paddedPageCount;
|
| 399 |
+
if (n > 0) {
|
| 400 |
+
for (let i = 0; i < n / 2; i += 2) {
|
| 401 |
+
reorderedPages.push(finalSequence[n - 1 - i]);
|
| 402 |
+
reorderedPages.push(finalSequence[i]);
|
| 403 |
+
reorderedPages.push(finalSequence[i + 1]);
|
| 404 |
+
reorderedPages.push(finalSequence[n - 2 - i]);
|
| 405 |
+
}
|
| 406 |
}
|
| 407 |
|
| 408 |
setProgress(40);
|
|
|
|
| 645 |
);
|
| 646 |
};
|
| 647 |
|
| 648 |
+
export default App;
|