I’m trying to rotate page in web-base(groupdoc viewer) but this still cannot be done. I would like to know if this avialible for rotate function and how to.
To enable page rotation in the GroupDocs Viewer, you need to ensure that the rotation functionality is properly configured in your project. Here are the steps you can follow:
-
Enable Rotation Buttons: In your
UIConfig.cs
file, set the rotation flag toTRUE
to display the rotation buttons in the viewer interface. -
Implement Rotation Logic: You need to implement the logic that handles the rotation of pages. Below is an example of how to rotate a page using the GroupDocs Viewer in a .NET application:
using System; using System.IO; using GroupDocs.Viewer; using GroupDocs.Viewer.Options; namespace GroupDocs.Viewer.Examples.CSharp.AdvancedUsage.Rendering.CommonRenderingOptions { /// <summary> /// This example demonstrates how to rotate the first page 90 degrees clockwise. /// </summary> class FlipRotatePages { public static void Run() { string outputDirectory = Utils.GetOutputDirectoryPath(); string outputFilePath = Path.Combine(outputDirectory, "output.pdf"); using (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX)) { PdfViewOptions viewOptions = new PdfViewOptions(outputFilePath); viewOptions.RotatePage(1, Rotation.On90Degree); // Rotate the first page viewer.View(viewOptions); } Console.WriteLine($"\nSource document rendered successfully.\nCheck output in {outputDirectory}."); } } }
-
Test the Functionality: After implementing the above code, run your application and test the rotation buttons in the viewer. If they still do not work, ensure that your viewer is correctly set up to handle the rotation events.
If you continue to experience issues, consider checking the documentation or community forums for additional troubleshooting tips.
Sources:
[1]: Rotate not working in Examples
Hi @Thitinan
Thank you for using the GroupDocs.Viewer. In order to give you the best answer please clarify the next:
- Are you using the GroupDocs.Viewer standalone library or a GroupDocs.Viewer.UI?
- On which platform you tried to use the GroupDocs.Viewer? Is it a .NET, Java, Node.JS or something else?
- It will be excellent if you will post here some code sample, which you’ve tried on your side and have not succeeded.
For the case if you’re using the GroupDocs.Viewer for .NET standalone library, the article “Rotate pages” is what you looking for.
With best regards,
Denis Gvardionov
Thank you, I will try this and update again if any question
@denisgvardionov @Professionalize.Discourse
I am using the GroupDocs.Viewer standalone library for .NET, and I have downloaded the sample project from GitHub under ‘Demos/ASP.NET Web Forms’ to test it.
I have already enabled the rotation buttons in UIConfig.cs
, and the rotate buttons are now displayed on the document preview page.
Could you please advise me where I should implement the rotation logic in order to make the rotate function actually work?
I have reproduced this issue, it was fixed in the client application. To enable rotation you have to set Rotate
to true
in UIConfig.cs
class as you already did. Please pull the latest changes from the repository and try running the app one more time.
The rotation is only performed on the client side and not persistent.
Also, it worth mentioning that the client app static files can potentially be cached by a browser, so make sure to cleanup the cache when running the app after pulling the changes.
Hi @vladimir.litvinchik,
Thank you for your support. I can now successfully rotate the document as needed. Your guidance was very helpful.