Free Support Forum -

Centre of rotation when rotating Graph (PDF.Net)



I have a page with a full page graph object on it and I want to rotate the Graph by 180 degrees however when I do after some tests I can see the centre of rotation is the top left of the page.

How can I change the centre of rotation to the centre of the page.





Thank you for contacting support.

Please note that Aspose.PDF for .NET can rotate pages with Page.Rotate property as explained in Manipulate Page in a PDF File. If you are able to rotate the page with Adobe Acrobat some other way, then please share source and generated files so that we may investigate further to help you out.



The problem is I have rotated the page but it rotates the graph too and I don’t want it to, I’ve tried IsSetPosition = false but that seems to do nothing when the page is rotated and as I said the graph.GrphInfo.RotationAngle rotates around top left, if I can change that to rotate around the centre of the graph then that will solve my problem.

So, is it possible to change the graph to rotate around the centre of the graph rather than the top left?





You may try to change page orientation to landscape using page.PageInfo.IsLandscape property. Or, after rotating the graph, you may try to change position of graph with graph.Left and graph.Top property by using values of Media Box or Crop Box values as explained in Get Page Properties.

graph.Left = page.MediaBox.LLX;

If you still face any problem, then please share your source and expected output PDF file along with narrowed down code snippet so that we may investigate further and help you out.


Just an FYI I managed to solve this in the end by rotating the graph so that when the page is rotated the graph is in the right position, real pain but got it working at least!



Thank you for your kind feedback.

We are glad to know that your issue has been resolved. Please keep using our API and in event of any further query, feel free to ask.