PdfPageWithRotationExtension extension

Extension to add rotation capability to PdfPage.

Use these functions to create rotated pages when reorganizing or combining PDFs.

The following example shows how to fix page orientations:

final doc = await PdfDocument.openFile('document.pdf');
doc.pages = [
  doc.pages[0],
  doc.pages[1].rotatedTo(PdfPageRotation.clockwise90),
  doc.pages[2].rotatedBy(PdfPageRotation.clockwise90),
  doc.pages[3].rotatedCW90(),
];
await File('fixed.pdf').writeAsBytes(await doc.encodePdf());
on

Methods

rotated180() PdfPage

Available on PdfPage, provided by the PdfPageWithRotationExtension extension

Rotates a page clockwise by 180 degrees.
rotatedBy(PdfPageRotation delta) PdfPage

Available on PdfPage, provided by the PdfPageWithRotationExtension extension

Rotates a page with rotation added to the current rotation.
rotatedCCW90() PdfPage

Available on PdfPage, provided by the PdfPageWithRotationExtension extension

Rotates a page counter-clockwise by 90 degrees.
rotatedCW90() PdfPage

Available on PdfPage, provided by the PdfPageWithRotationExtension extension

Rotates a page clockwise by 90 degrees.
rotatedTo(PdfPageRotation rotation) PdfPage

Available on PdfPage, provided by the PdfPageWithRotationExtension extension

Rotates a page with the specified rotation.