Last active
January 12, 2016 13:53
-
-
Save Polaringu/5d9089d0d6f0cd3231f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void verifyPageLinksToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
if (pdfCtl.Doc == null) | |
return; | |
uint GoTo = pxsInst.StrToAtom("GoTo"); | |
uint GoToR = pxsInst.StrToAtom("GoToR"); | |
uint Launch = pxsInst.StrToAtom("Launch"); | |
uint invalidCount = 0; | |
for (uint i = 0; i < pdfCtl.Doc.CoreDoc.Pages.Count; i++) | |
{ | |
PDFXEdit.IPXC_Page page = pdfCtl.Doc.CoreDoc.Pages[i]; | |
uint annotsCount = page.GetAnnotsCount(); | |
for (uint j = 0; j < annotsCount; j++) | |
{ | |
PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j); | |
PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up); | |
for (uint k = 0; k < actions.Count; k++) | |
{ | |
if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR)) | |
{ | |
PDFXEdit.IPXC_Action_Goto actionGoTo = (PDFXEdit.IPXC_Action_Goto)actions[k]; | |
if (actionGoTo.IsValid == false) | |
{ | |
invalidCount++; | |
} | |
else if (actions[k].Type == GoToR) | |
{ | |
PDFXEdit.IPXC_FileSpec path = actionGoTo.Target; | |
if (File.Exists(path.DIPath) == false) | |
invalidCount++; | |
} | |
} | |
else if (actions[k].Type == Launch) | |
{ | |
PDFXEdit.IPXC_Action_Launch actionLaunch = (PDFXEdit.IPXC_Action_Launch)actions[k]; | |
if (actionLaunch.IsValid == false) | |
{ | |
invalidCount++; | |
} | |
else | |
{ | |
PDFXEdit.IPXC_FileSpec path = actionLaunch.FileSpec; | |
if (path == null) | |
{ | |
if (File.Exists(actionLaunch.FileName) == false) | |
invalidCount++; | |
} | |
else | |
{ | |
if (File.Exists(path.DIPath) == false) | |
invalidCount++; | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment