Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, October 18, 2019 1:59:47 PM(UTC)
Matthew Bresson

Groups: Registered, Tech Support, Administrators
Posts: 105

Was thanked: 3 time(s) in 3 post(s)

When working with the Document Viewer there are a few options to achieve document page rotation.

You can use Page and View Commands to rotate the document page(s) in the viewer, however these fields rotate the page(s) either clockwise or counter clockwise by 90 degrees:

In this post we are going to focus on how to rotate the document page in the viewer by any degrees from 0 to 360 using the RotateCommand.
To run image pre-processing commands on documents in the Document Viewer you will need to use the GetImage() and SetImage() methods.
This example is using the DocumentFactory to create a new LEADDocument "virtual document". Then loading in a document into the Document Viewer using LoadFromFile() and SetDocument().


private void RotatePage(int angle)
            var selectedPage = virtualDocument.Pages[documentViewer.CurrentPageNumber - 1];
            var rasterImage = selectedPage.GetImage();

            RotateCommand command = new RotateCommand();
            command.Angle = angle;
            command.FillColor = new RasterColor(255, 255, 255);
            command.Flags = RotateCommandFlags.Resize;


Attached is a sample project containing the snippet above. After you supply the document you want to use for the viewer, it will load the document. You can then select which page you want to rotate. After you do the rotation you can then save the document out to "C:\Temp\RotatedPage.pdf" and see that not only was the page rotated in the viewer but the page is now rotated in the exported file also.
File Attachment(s):
RotateDocumentWinforms.zip (271kb) downloaded 30 time(s).
Matt Bresson
Developer Support Engineer
LEAD Technologies, Inc.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.050 seconds.