-
1. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 12:39 AM (in response to arvindg007)Hi,
The easier way is to simulate the click on the button in the Acrobat window using the JavaScript function ExecuteMenuItem(). If you have the name of the rotation menu item it will be easier. (the name is : RotateCW)
Regards,
Joe
-
2. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 2:50 AM (in response to joeln3)Hi Joe,
Thanks for your suggestion !
And I tried AVMenuItemExecute method but this is not working for me. I think this method works for active doc only. And I didn't find any api to make my doc as active doc.
Regards,
Arvind
-
3. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 2:55 AM (in response to arvindg007)hi Arvind,
I have some question :
- Is the document open in an Acrobat window?
- What is the result when you use the AVMenuItemIsEnabled? Is the MenuItem enable?
For the window you can use the AVWindowBecomeKey to make it the key window (note that the window has to be visible).
Regards,
Joe
-
4. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 3:41 AM (in response to joeln3)Hi Joe,
AVMenuItemIsEnabled method returns false in my case. I don't know why it is coming like that?. But when I press (Shift+Ctrl+plus), it rotates the page so it means in actual rotate menu is enabled . Is some thing wrong in my code (see below)
AVMenubar theMB = AVAppGetMenubar();
AVMenuItem rotateMenu = AVMenubarAcquireMenuItemByName(theMB,
"RotateCW");
if
(AVMenuItemIsEnabled (rotateMenu))
{
AVWindowBecomeKey ( AVDocGetAVWindow(avDoc));
AVMenuItemExecute (rotateMenu);
}
Regards,
Arvind
-
5. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 4:00 AM (in response to arvindg007)Hi,
My mistake. Actually you can't use "RotateCW" but you can use "RotatePages". Using RotatePages a popup appears.
What is exactly your need?
Regards,
Joël
-
6. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 4:18 AM (in response to joeln3)Hi Joe,
Actually in my application, I have to create my own Rotate View button. And using that button I have to simulate the same thing which we can do using RotateCW or RotateCCW in standalone reader.
Since PDPageSetRotate method is not available for reader plug-in and that's why I tried to rotate the view using cos method but that rotates page content but don't change the display size of paper and that's the issue I am facing.
I tried Rotatepages also but I am getting NULL value for this item.
Regards,
Arvind
-
7. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 4:21 AM (in response to arvindg007)And using "RotatePages". It's case sensitive.
-
8. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 4:26 AM (in response to joeln3)Yes , I used "RotatePages" only but I am getting NULL value for that. But if it works also then pop-up issue will be there for me.
Regards,
Arvind
-
9. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 4:35 AM (in response to arvindg007)It's is strange. How did you open the document in Acrobat? I mean which method are you using?
-
10. Re: How to rotate the page view using cos method
MrRamrod Aug 6, 2009 4:53 AM (in response to joeln3)Menus will not be available if the viewer is being run as an embedded window (inside another application, for example)
That would explain why executing menu items will not work.
-
11. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 5:12 AM (in response to joeln3)I open the document using Active-X method named LoadFile(fileName) which is available for reader.
-
12. Re: How to rotate the page view using cos method
joeln3 Aug 6, 2009 5:17 AM (in response to arvindg007)As said if the menu bar is not displayed you can't use it. But if the buttons are displayed you can try to execute the button "RotateCW".
-
13. Re: How to rotate the page view using cos method
MrRamrod Aug 6, 2009 5:43 AM (in response to joeln3)instead of executing a menu/toolbutton (which arent available it would seem), is there an API call which performs the required operation
i.e. is there an API method (or set of methods) that will rotate the view instead of the page?
-
14. Re: How to rotate the page view using cos method
arvindg007 Aug 6, 2009 5:55 AM (in response to joeln3)Tool button RotateCW is also not working for me. As AVToolButtonIsEnabled(myToolButton) returns false for me (see below code that I used for this ).
const char * toolBarName = "PageDisplay";
AVToolBar myToolBar = AVAppGetToolBarByName(toolBarName);
AVToolButton myToolButton = AVToolBarGetButtonByName(myToolBar, ASAtomFromString("RotateCW"));
if(AVToolButtonIsEnabled(myToolButton))
AVToolButtonExecute(myToolButton);
This is very strange, because I can see the same tool button in the display and it works fine also if you press it.
Regards,
Arvind
-
15. Re: How to rotate the page view using cos method
arvindg007 May 15, 2012 3:35 AM (in response to arvindg007)Hi,
Any idea...how we can rotate page using code(i.e plug-in api, JS api or thru Cos method) for acrobat reader ? RotatePage thru cos method rotate the page but it doesn't show full content of page .
Regards,
Arvind
-
16. Re: How to rotate the page view using cos method
lrosenth May 15, 2012 3:42 AM (in response to arvindg007)I don’t understand when you say “it doesn’t show full contents of the page”.
If you rotate the MediaBox and you rotate the content, then it will all show.
-
17. Re: How to rotate the page view using cos method
arvindg007 May 22, 2012 12:06 AM (in response to lrosenth)Hi Irosenth,
For Reader PDPageSetMediaBox is not available. So I tried following code to rotate the media Box but it doesn’t work.
PDDoc pdDoc = AVDocGetPDDoc(avDoc);
int nNumPage = PDDocGetNumPages(pdDoc);
CosDoc cosDoc = PDDocGetCosDoc(pdDoc);
PDPage pdPage;
for(int iPg=0; iPg<nNumPage; iPg++)
{
pdPage = PDDocAcquirePage(pdDoc, iPg);
CosObj pageCos = PDPageGetCosObj(pdPage);
CosObj rectangle;
rectangle = CosDictGet(pageCos, ASAtomFromString("MediaBox"));
CosObj left = CosArrayGet (rectangle, 0L);
CosObj bottom = CosArrayGet (rectangle, 1L);
CosObj right = CosArrayGet (rectangle, 2L);
CosObj top = CosArrayGet (rectangle, 3L);
double vl = ASFixedToFloat(CosFixedValue (left));
double vr = ASFixedToFloat(CosFixedValue (right));
double vt = ASFixedToFloat(CosFixedValue (top));
double vb = ASFixedToFloat(CosFixedValue (bottom));
double w = vr-vl;
double h = vt-vb;
vr = vl+ h;
vt = vb+w;
CosObj newR = CosNewFixed (cosDoc, false, ASFloatToFixed(vr));
CosObj newT = CosNewFixed (cosDoc, false, ASFloatToFixed(vt));
CosObj newRectangle;
newRectangle = CosNewArray (cosDoc, false, 4L);
CosArrayPut (newRectangle , 0L, left);
CosArrayPut (newRectangle , 1L, bottom);
CosArrayPut (newRectangle , 2L, newR);
CosArrayPut (newRectangle , 3L, newT);
CosDictPut (pageCos, ASAtomFromString("MediaBox"),newRectangle)
PDPageRelease (pdPage);
}
Any Idea what else I need to do to make it work ?. I have even called following code after above code.
AVWindow win = AVDocGetAVWindow(avDoc);
AVWindowDrawNow(win);
AVPageView pageView = AVDocGetPageView (avDoc);
AVPageViewDrawNow (pageView);
But this also doesn’t update media box.
Please let me know your view on this.
Thanks in advance
Arvind
-
18. Re: How to rotate the page view using cos method
lrosenth May 22, 2012 4:05 AM (in response to arvindg007)That code will change the Cos objects, but won't force Reader to re-render the page…because it's Reader, and you shouldn't be modifying things in Reader.
-
19. Re: How to rotate the page view using cos method
arvindg007 May 22, 2012 4:16 AM (in response to lrosenth)Then how to rotate page/view in Reader thru code ?
-
20. Re: How to rotate the page view using cos method
MrRamrod May 22, 2012 5:13 AM (in response to arvindg007)Another way of approaching this.
If we cannot modify the page, can we rotate the camera?



