How is it possible to get the Rotation angle of a rectangle ? Which method or field ? Both methods in specification are to set the angle, but none like a kind of getRotate method name.
In Aspose.PDF, Page.getRectangle() property is implemented. However, can you please share what type of rectangle is there in your PDF and how you are reading it? Please share a sample PDF as well so that we can proceed further to assist you.
00244673_12yco5 - Erra Daya Services - SOW1 to SA Short 04-2011.pdf (217.0 KB)
If I have a look the images I extract, I see they are rotated: output_0_1.jpg (535.7 KB)
ImagePlacementAbsorber abs = new ImagePlacementAbsorber();
var j = 0;
foreach (Page page in this.pdf.Pages) {
int H = (int) page.GetPageRect(true).Height;
int W = (int) page.GetPageRect(true).Width;
Console.WriteLine($"Page {j}: {W} {H}");
page.Accept(abs);
int max_image_h = 0;
int max_image_w = 0;
for(int i = 1;i <= abs.ImagePlacements.Count;i++){
ImagePlacement image = abs.ImagePlacements[i];
int h = (int) image.Rectangle.Height;
int w = (int) image.Rectangle.Width;
Console.WriteLine($" {h} {w}");
}
j ++;
}
gives me:
Page 0: 595 842
599 x 844
427 x 607
Page 1: 595 842
599 x 844
427 x 607
599 x 844
421 x 598
So what I imagine is that the image rectangles are rotated because I had to switch width and height to have something print correctly
595 => 599
842 => 844
With 21.5 version of Aspose.PDF for .NET, we were able to extract the rotation of the image inside PDF by accessing Image.Rotation property. Please check the below sample code:
for (int i = 1; i <= abs.ImagePlacements.Count; i++)
{
ImagePlacement image = abs.ImagePlacements[i];
int h = (int)image.Rectangle.Height;
int w = (int)image.Rectangle.Width;
Console.WriteLine($" {h} {w}");
// get image rotation
Console.WriteLine(image.Rotation);
}