mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
26cdb1d04f
Frontend traverser needs to be updated
16 lines
438 B
JavaScript
16 lines
438 B
JavaScript
export async function rotatePages (snapshot, rotation, PDFLib) {
|
|
// Load the original PDF file
|
|
const pdfDoc = await PDFLib.PDFDocument.load(snapshot, {
|
|
parseSpeed: PDFLib.ParseSpeeds.Fastest,
|
|
});
|
|
|
|
const pages = pdfDoc.getPages();
|
|
|
|
pages.forEach(page => {
|
|
// Change page size
|
|
page.setRotation(PDFLib.degrees(rotation))
|
|
});
|
|
|
|
// Serialize the modified document
|
|
return pdfDoc.save();
|
|
}; |