Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

67
Views
Rotate a page with pdf-lib and javascript

I am making a website that can modify pdf files , and I was trying to be able to rotate a page or multiple pages but couldn't find how to do that in their docs .


 const pdfDoc = await loadSingleFile(inputFiles[0]) // An input pdf file

 const rotatedPdf = await PDFDocument.create();  // Intitialize the rotated pdf file

 const pageToRotate = pdfDoc.getPages()[pageIndex]
    

  // Not sure what to write here


 const pdfDataString = await rotatedPdf.saveAsBase64({ dataUri: true }); // here generate string for further use
7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs