Hi @tahir.manzoor,
According your solution, you are just creating new object as
action = new GoToAction(new XYZExplicitDestination(1, 0, doc.Pages[1].PageInfo.Height, 2));
in this case what ever values you give on Zoom values at fourth parameter it returns the same. But I want the original zoom value of the document.
Details:
When we try to retrieve document magnification, we first try to get the openAction of a document using below line of code.
GoToAction action = (GoToAction)pdfDoc.OpenAction;
When the action is retrieved then the document magnification value is returned correctly.
When the action returns null then we tried to get action by creating GoToAction using below code snippet.
if (pdfdoc.OpenAction == null)
{
//Document has no action, magnification is null
//Create new GoToAction
action = new GoToAction(new XYZExplicitDestination(1, 0, pdfDoc.Pages[1].PageInfo.Height,3));
}
In the above code snippet.
When we try to create new GoToAction().
The 4th parameter double zoom passed will return same value when we try to extract destination Zoom value.
For example, in the below code snippet we are passing value as 3
//Create new GoToAction
action = new GoToAction(new XYZExplicitDestination(1, 0, pdfDoc.Pages[1].PageInfo.Height,3));
When we try to get the zoom value using below code snippet
XYZExplicitDestination dest = null;
if ((dest = gotoaction.Destination as XYZExplicitDestination) != null)
{
double value = dest.Zoom;
}
The dest.zoom returns whatever we have passed as 4th parameter in create GoToAction. We have passed 3 in create GoToAction hence we get dest.zoom value as 3.
If we pass 4 we will get 4 which is incorrectly determining the zoom factor.
The Magnification of a document with action null is incorrectly returning the zoom factor using above code snippet.