Print Page | Close Window

RotatePage repeatedly how?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1594
Printed Date: 06 May 25 at 4:17PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: RotatePage repeatedly how?
Posted By: kerrywales
Subject: RotatePage repeatedly how?
Date Posted: 06 Oct 10 at 10:43PM
I have code to scan in to a pdf. I need a simple viewer to allow the user some simple actions on the scanned in file.

I have all that I need except one. The ability to rotate the page as needed. Here is my code for a rotate clockwise. (I am using CS 2008 & c#)

private void btnViewScanRotateClockwise_Click(object sender, EventArgs e)
        {
            DLL myDLL = new DLL("QuickPDFDLL0721.dll");
            int InstanceID;
            InstanceID = myDLL.QuickPDFCreateLibrary();
            if (myDLL.QuickPDFUnlockKey(InstanceID, "license here") == 1)
            {
                System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();
                Byte[] BytesMessage = UTF8.GetBytes(ScannedFile);
                myDLL.QuickPDFLoadFromFile(InstanceID, BytesMessage);
                myDLL.QuickPDFSelectPage(InstanceID, CurrentPageNo);
//CurrentPageNo is the var in my Viewer used to know which is the current page to be viewed
//The rotate page only works for the first 90 deg rotation
                myDLL.QuickPDFRotatePage(InstanceID, 90);
                MessageBox.Show(myDLL.QuickPDFGetOrigin(InstanceID).ToString());
                myDLL.QuickPDFSaveToFile(InstanceID, BytesMessage);
//DisplayPage is my routine to display the page in a PictureBox on the screen
                DisplayPage();
                myDLL.QuickPDFReleaseLibrary(InstanceID);
            }
        }

This rotates the page 90 deg once and saves the file displaying the page rotated in its new position. I am used to this being the anchor point. So I expected running the routine again to take the page in its current position and rotate it another 90 deg. It doesn't.
I therefore presume that instead of rotating the page in the file it maintains it's original position but stores some kine of offset that tells it to rotate the image 90 deg in the display.

Therefore for me to rotate it again I must find out where my starting point is i.e. if it is in the 90 deg position then I execute the rotate to 180 etc.

I cannot find the call to make to know my starting point in order to rotate it further.

When I have worked it out clockwise then I can right its mirror routine to write the anticlockise code.

Regards

Kerry



Replies:
Posted By: Rowan
Date Posted: 20 Oct 10 at 1:52PM
Hi Kerry,

You can use the PageRotation function to determine the current rotation of a page -- that function will help you determine your starting point.

PageRotation
http://www.quickpdflibrary.com/help/quickpdf/PageRotation.php - http://www.quickpdflibrary.com/help/quickpdf/PageRotation.php

- Rowan.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk