mirror of
https://github.com/24eme/signaturepdf
synced 2026-03-14 13:55:44 +01:00
booklet: using function resizePage to center page
This commit is contained in:
parent
7f3d6af325
commit
75a2aa7beb
1 changed files with 6 additions and 6 deletions
|
|
@ -704,31 +704,31 @@ async function merge2Pages(pdf, pageA, pageB, pageWidth, pageHeight) {
|
|||
const newPageHeight = Math.min(pageWidth, pageHeight);
|
||||
const page = pdf.addPage([newPageWidth, newPageHeight]);
|
||||
if(pageA) {
|
||||
resizePage(pageA, newPageWidth / 2, newPageHeight);
|
||||
const pageEmbeddedA = await pdf.embedPage(pageA, {
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: pageA.getWidth(),
|
||||
top: pageA.getHeight(),
|
||||
});
|
||||
|
||||
const pageEmbeddedDimsA = pageEmbeddedA.scale((newPageWidth / 2) / pageA.getWidth());
|
||||
page.drawPage(pageEmbeddedA, {
|
||||
...pageEmbeddedDimsA,
|
||||
width: pageEmbeddedA.width,
|
||||
height: pageEmbeddedA.height,
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
}
|
||||
if(pageB) {
|
||||
resizePage(pageB, newPageWidth / 2, newPageHeight);
|
||||
const pageEmbeddedB = await pdf.embedPage(pageB, {
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: pageB.getWidth(),
|
||||
top: pageB.getHeight(),
|
||||
});
|
||||
|
||||
const pageEmbeddedDimsB = pageEmbeddedB.scale((newPageWidth / 2) / pageB.getWidth());
|
||||
page.drawPage(pageEmbeddedB, {
|
||||
...pageEmbeddedDimsB,
|
||||
width: pageEmbeddedB.width,
|
||||
height: pageEmbeddedB.height,
|
||||
x: newPageWidth / 2,
|
||||
y: 0,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue