Loading...

Image Rotation when viewing multipge tiff (GdPicturePro5)

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Image Rotation when viewing multipge tiff (GdPicturePro5)

Postby justcode » Wed Aug 19, 2009 1:58 pm

I modified the sample code for Visual C++ to include more funtionality as a test app. I noticed using the following control:
GdPicturePro5.GdViewer
CLSID: {96663DB2-110C-45A2-8B0E-9616ECB11697}

When you open a multiple page TIFF, then go to a page and rotate it, if you go to the next page then back, the rotation does not stay and it reverts back to the original orientation.

I tried it with version 4 VB demo app that is using the same calls and it works fine and remembers the rotation set.
CLSID: {C9C356DE-E87E-4633-B3A9-344E5F821BB7}

Is this a bug in version 5 or did you change the way the page is viewed and rotated from version 4 -> 5???

Code: Select all
m_viewer.DisplayFromFile("....13page.tif"); // load 13 page tiff

// buttons get pressed to execute the following lines

m_viewer.DisplayNextFrame();          // goto page 2
m_viewer.Rotate90();                  // rotate 90 degrees
m_viewer.DisplayPreviousFrame();   // go back to page 1
m_viewer.DisplayNextFrame();         // go back to page 2 and the rotation is missing



The same code loading the V4 ocx control seems to work fine.
Please advise..

-Paul R
Paul R. Rondeau
Sr. Software Engineer
MultiProcess Computer Corporation
User avatar
justcode
 
Posts: 24
Joined: Wed Jul 15, 2009 9:20 pm

Re: Image Rotation when viewing multipge tiff (GdPicturePro5)

Postby Loïc » Fri Aug 21, 2009 12:39 pm

Hi Paul,

it is not a bug. You have to open the multipage tiff as read & write using the Imaging control. Then you will be able to pass the image to a GdViewer control using GetNativeImage/SetNativeImage.


IE:

Code: Select all
Imaging1.TiffOpenMultiPageAsReadOnly (False)
Imaging1.TiffCreateMultiPageFromFile ("multipage.tif")
GdViewer1.SetNativeImage (Imaging1.GetNativeImage)



Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Image Rotation when viewing multipge tiff (GdPicturePro5)

Postby justcode » Fri Aug 21, 2009 2:09 pm

I did know that. The user is only viewing the document, not editing it. Sometimes when the document gets scanned, they miss a page or two that are the wrong orientation. They are viewing a read-only document in the viewer. As they read the document, they may rotate the page so they can read it. By reverting back, the user can get confused. I do not open it in edit mode because some of the multipage tiffs can get huge and it takes too long to open and it is a waste of resources to open it for editing.

I just wanted to make sure that this is by design before I write a work around for the action. I will have to remember all the page orientations and rotate any user rotated pages before displaying them back to the user. The reason I even brought this up is that the version 4 demo app opens the document the same way I do, using the same calls, but it remembers the orientation and does not revert back.

I am using Visual C++ with MFC for my project, but referencing your VB code as examples. The V4 project was from: .\GdViewer ActiveX\samples\vb\basic_viewer. In Form1.frm it showed the veiwer using the following code to open a multipage tiff document.

Code: Select all
Private Sub Command1_Click()
   
   Me.CommonDialog1.Filter = "All Files (*.*)|*.*|PDF (*.pdf)|*.pdf|JPEG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|TIF (*.tif)|*.tif|Gif (*.gif)|*.gif |PNG (*.png)|*.png|Icon (*.ico)|*.ico|Windows Meta Files (*.wmf)|*.wmf"
   Me.CommonDialog1.ShowOpen
   If Len(Me.CommonDialog1.FileName) > 0 Then
      Me.GdViewer1.CloseImage
      Me.GdViewer1.DisplayFromFile (Me.CommonDialog1.FileName)
   End If
End Sub


and to rotate the images in the viewer as:

Code: Select all
Private Sub Command3_Click()
   Me.GdViewer1.Rotate90
End Sub

Private Sub Command4_Click()
   Me.GdViewer1.Rotate270
End Sub


This is the same way I am doing it now, except the V4 code does not revert the orientation, like the V5 code does.
I can remember the orientations and update it when the user goes to that page, the only issue I can see is if the user prints the document.

-Paul
Paul R. Rondeau
Sr. Software Engineer
MultiProcess Computer Corporation
User avatar
justcode
 
Posts: 24
Joined: Wed Jul 15, 2009 9:20 pm

Re: Image Rotation when viewing multipge tiff (GdPicturePro5)

Postby justcode » Fri Aug 21, 2009 5:41 pm

I tried to select a page, then rotate it while the LockControl property is set to TRUE so the user does not see the rotate, but the rotation does not seem to have happened after LockControl is set to FALSE and a redraw is done.

Code: Select all
long CGDViewerCtrl::DisplayPage(long nPage, long lOrientation)
{
    C_GdViewer::SetLockControl(TRUE);
    long m_vPos = C_GdViewer::GetVScrollBarPosition();
    long m_hPos = C_GdViewer::GetHScrollBarPosition();
   
    long lValue = C_GdViewer::DisplayFrame(nPage);   

    switch(lOrientation)
    {
        case 90:
            C_GdViewer::Rotate90();
            break;
       
        case 180:
            C_GdViewer::Rotate180();
            break;

        case 270:
            C_GdViewer::Rotate270();
            break;

        default: // 0
            break;
    }
   
    C_GdViewer::SetHScrollBarPosition(m_hPos);
    C_GdViewer::SetVScrollBarPosition(m_vPos);
    C_GdViewer::SetLockControl(FALSE);
    C_GdViewer::Redraw();

    return lValue;
}


I assume that you can not make multiple calls while the control was locked. I would have guessed that is the whole reason for the call, to lock the updating while we did multiple actions.... But I did not come up with the specs for it.

I did however get the call to work by replacing the SetLockControl calls with ShowWindow();

Code: Select all
long CGDViewerCtrl::DisplayPage(long nPage, long lOrientation)
{
    ShowWindow(SW_HIDE);
    long m_vPos = C_GdViewer::GetVScrollBarPosition();
    long m_hPos = C_GdViewer::GetHScrollBarPosition();
   
    long lValue = C_GdViewer::DisplayFrame(nPage);   

    switch(lOrientation)
    {
        case 90:
            C_GdViewer::Rotate90();
            break;
       
        case 180:
            C_GdViewer::Rotate180();
            break;

        case 270:
            C_GdViewer::Rotate270();
            break;

        default: // 0
            break;
    }
   
    C_GdViewer::SetHScrollBarPosition(m_hPos);
    C_GdViewer::SetVScrollBarPosition(m_vPos);
    ShowWindow(SW_SHOW);

    return lValue;
}


The lOrientation is stored in an array and is updated whenever the user rotates a page. My thumbnail control is updated when the image is rotated, so once it is done it does not need to be updated. So now when the user goes to a page that has an orientation > 0, the image will be rotated before it is displayed.

It would be nicer if the viewer could keep track on orientation, even if the file is opened read-only. But when there is an issue, there is always a way around it, even if it takes you a while to get there.

-Paul
Paul R. Rondeau
Sr. Software Engineer
MultiProcess Computer Corporation
User avatar
justcode
 
Posts: 24
Joined: Wed Jul 15, 2009 9:20 pm


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest