Hi,
I am trying to read the Pdf Magnification value present in Initial View Tab.
regards,
Sriram Pujar
Hi,
I am trying to read the Pdf Magnification value present in Initial View Tab.
regards,
Sriram Pujar
You can get zoom-factor of PDF document using the code snippet shared in the linked article. In case you face any issue, please share your sample PDF with us. We will test the scenario in our environment and address it accordingly.
Hi Asad,
GoToAction action = doc.OpenAction as GoToAction;
I am getting action object as null.
In this document I have magnification = ‘Default’.
Please find the document linkrule_builder_N_All_Security.pdf (12.2 KB)
We have logged an investigation ticket as PDFNET-49807 in our issue tracking system after replicating the same exception at our end. We will further look into details of the logged ticket and inform you once the ticket is resolved. Please be patient and spare us some time.
We apologize for the inconvenience.
Would you please try the below code snippet with 21.11 version of the API and let us know in case you still notice any issues:
Document doc = new Document(dataDir + "rule_builder_N_All_Security.pdf");
double zoom;
GoToAction action;
if (doc.OpenAction == null)
{
//Document has no action, magnification is null
//Create new GoToAction
action = new GoToAction(new XYZExplicitDestination(1, 0, doc.Pages[1].PageInfo.Height, 2));
doc.OpenAction = action;
zoom = (action.Destination as XYZExplicitDestination).Zoom;
}
else
{
action = doc.OpenAction as GoToAction;
if (action.Destination is XYZExplicitDestination)
{
zoom = ((XYZExplicitDestination) action.Destination).Zoom;
}
}