get the link of pdf.

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

get the link of pdf.

Post by nais1 »

hello!

<question>
I would like to get the link of pdf.
i have 2 pdf.
one pdf has the link text for another pdf.
i would like to get the link document or URL when user clicked the link text.

<sample program>
Private Sub AxCoPDFXCview1_OnEvent(ByVal sender As System.Object, ByVal e As AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent) Handles AxCoPDFXCview1.OnEvent
MsgBox(AxCoPDFXCview1.?????)
End Sub

regards,
nais1
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: get the link of pdf.

Post by Corwin - Tracker Sup »

You can use next code for for getting URL text

Code: Select all

 Private Sub AxCoPDFXCview1_OnEvent(ByVal sender As System.Object, ByVal e As AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent) Handles AxCoPDFXCview1.OnEvent
     If e.type = PDFXCviewAxLib.PXCVA_EventTypes.PXCVA_OnDisplayPrompt Then
         If e.name = "Prompts.ConfirmOpenSite" Then
             Dim vDataOut As Object
             AxCoPDFXCview1.GetProperty("Prompts.ConfirmOpenSite.Name", vDataOut)
             MsgBox(vDataOut)
         End If
     End If
 End Sub
But this will work only with URLs. In next build we will try to add such functionality for opening PDF files also. Thanks.
nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

Re: get the link of pdf.

Post by nais1 »

thanks for the code.
i try and used it.
but i could not get the link. it didnt work.
tell me any advice please.

regards,
nais1
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: get the link of pdf.

Post by Corwin - Tracker Sup »

Please note that this code will work only with Web links. Also what build you are using?
nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

Re: get the link of pdf.

Post by nais1 »

thanks for support.
but i would like 2 more functions.
please add them to next version.

<function>
1. to get the information of the link to file.
2. silent mode(i would like to hide the link address and path & filename to my user)

regards,
nais1
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: get the link of pdf.

Post by Corwin - Tracker Sup »

Ok, we will try to add such functionality in near future.
Thanks.
nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

Re: get the link of pdf.

Post by nais1 »

hello!

i have questions.
1. have you added following functions in next version?
2. i would like to modify in an exist PDF's url.
how do i write it the VB.NET code?

<function>
1. to get the information of the link to file.
2. silent mode(i would like to hide the link address and path & filename to my user)

regards,
nais1
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: get the link of pdf.

Post by Corwin - Tracker Sup »

hi,

To hide link address you should disable tooltips on comments. This may be done by using the following code:

Code: Select all

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	AxCoPDFXCview1.SetProperty("Commenting.ShowTooltips", 0)
End Sub
You can receive notification from Viewer that user clicks on Web link or at the file link. To do this, use next code:

Code: Select all

Private Sub AxCoPDFXCview1_OnEvent(ByVal sender As System.Object, ByVal e As AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent) Handles AxCoPDFXCview1.OnEvent
  If e.type = PDFXCviewAxLib.PXCVA_EventTypes.PXCVA_OnDisplayPrompt Then
      If e.name = "Prompts.ConfirmOpenSite" Then
          Dim vDataOut As Object = 0
          AxCoPDFXCview1.GetProperty("Prompts.ConfirmOpenSite.Name", vDataOut)
          If MsgBox(vDataOut, MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then
              AxCoPDFXCview1.SetProperty("Prompts.ConfirmOpenSite.UserChoice", "Cancel")
          End If
      End If

      If e.name = "Prompts.ConfirmLaunchFile" Then
          Dim vDataOut As Object = 0
          AxCoPDFXCview1.GetProperty("Prompts.ConfirmLaunchFile.FileName", vDataOut)
          If MsgBox(vDataOut, MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then
              AxCoPDFXCview1.SetProperty("Prompts.ConfirmLaunchFile.UserChoice", "Cancel")
          End If
      End If
  Else
      If e.type = PDFXCviewAxLib.PXCVA_EventTypes.PXCVA_OnNamedNotify Then
          Dim vDataOut As Object = 0
          AxCoPDFXCview1.GetProperty("Notifications.ContextMenu.MenuName", vDataOut)
          If vDataOut = "UrlLink" Then
              AxCoPDFXCview1.SetProperty("Notifications.ContextMenu.UserChoice", -1) ' disable context menu for links
          End If
      End If
  End If
End Sub
HTH.
nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

Re: get the link of pdf.

Post by nais1 »

thanks for your support.

but 2nd code is different from my thought. my explane may not be good.
yes, this code is able to get the url when user click the hyperlink.
i would like to replace the url in the many PDF file's hyperlink by my software.
like following.
1. load the pdf by AxCoPDFXCview1 of Active X.
2. find hyperlink and url.
3. replace the url. <==== how to replace?
4. save that pdf.
5. next pdf....

tell me more advice in VB.NET code.
i also have the license of PDF-Tools 4 SDK.

regards,
nais1
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: get the link of pdf.

Post by Corwin - Tracker Sup »

Hello nais1,

For now we don't have any functions to modify links actions in PDF document.
nais1
User
Posts: 17
Joined: Fri Jun 05, 2009 7:08 am

Re: get the link of pdf.

Post by nais1 »

thanks for your replay.
i hope you will add that function in next version.

regards,
nais1