Calling the Rotate Method with the Aspose.Pdf.Rotation.on270 enum does not rotate the page. I am not sure if Aspose is expecting me to re-render the document somehow. I am following this documentation. The code is below:
// The Rotate Page Button That drives Editor rotation
private void tsbRotatePageCCW_Click(object sender, EventArgs e)
{
_document.RotatePage(Aspose.Pdf.Rotation.on270);
DisplayPage();
//pdfViewer.Rotate(System.Drawing.RotateFlipType.Rotate270FlipNone);
}
public void RotatePage(Aspose.Pdf.Rotation rotation)
{
_pdf.Pages[_currentPage].Rotate = rotation;
OnSelectedPageChanged(new SelectedPageChangedEventArgs(_currentPage));
}
// Replace Image in PdfViewer with new PDF Image
private void DisplayPage()
{
pdfViewer.Image = Page.ConvertPDFPagetoImage(_document.CurrentPage.Content);
}
// Converts the Aspose PDF to a BMP Image
public static System.Drawing.Image ConvertPDFPagetoImage(Aspose.Pdf.Page page)
{
Aspose.Pdf.Devices.BmpDevice imageDevice = new Aspose.Pdf.Devices.BmpDevice();
using (MemoryStream ms = new MemoryStream())
{
// Convert a particular page and save the image to stream
imageDevice.Process(page, ms);
return System.Drawing.Image.FromStream(ms);
}
}
Using the Latest version of Aspose PDF (v25.3.0)