I have created a function for crop a pdf page
const existingPdfBytes = await fs.promises.readFile('input.pdf');
const existingPdfDoc = await PDFDocument.load(existingPdfBytes);
const pdfPage = existingPdfDoc.getPages()[0];
pdfPage.setCropBox(0, 200, 595, 842);
Now I want to rotate that cropped pdf and place 5 pdf on single pdf using
const rotatedPdfDoc = await PDFDocument.create();
const [embeddedPage] = await rotatedPdfDoc.embedPdf(existingPdfDoc, [0]);
newPage.drawPage(embeddedPage, {
x: 227,
y: 421,
width: 297,
height: 297,
rotate: degrees(-90),
});
but while embedding getting without cropped data, how can I perform with cropped data
I am using pdf-lib for performing this task, but facing issue to combine both method setCropBox and drawPage both have diffrent data required