Good day,
I am trying to open a pdf url using vbscript. The pdf is on a local pc. I am using vbscript to open the url and using chrome. In my Url I use a #Search=Register this will make the pdf open and search for the first occurrence of Register.
My problem is it seems that my Url gets % encoded even my # gets encoded to %23 and then the chrome pdf preview is not working.
My vbscript code :
Dim strChrome
Dim WShellChrome
Dim strUrl
Set WShellChrome = CreateObject("WScript.Shell")
strChrome = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
strUrl = "\\myserver/HelpDocumentation/Configuration - Company Configuration.pdf#Search=Register"
WShellChrome.Run chr(34) + strChrome + chr(34) & " " & chr(34) + strUrl + chr(34), 1, false
When I run this code it opens up Chrome with the following url:
file://myserver/HelpDocumentation/Configuration%20-%20Company%20Configuration.pdf%23Search=Register
Note the % url encoding that has occurred. The %20 is a space and the %23 is the #
The browser then cant find the pdf Url because the # was encoded to %23. If I change the %23 in the browser url to # it works and the pdf is displayed.
It seems like the %20 (space) is ok in the url but it does not like the %23(#).
I need the # in the url to open the pdf and search a specific string.
It also seems not to be the vbscript, if I copy the url :
\\myserver/HelpDocumentation/Configuration - Company Configuration.pdf#Search=Register
And paste it into my chrome url it auto converts the spaces to %20 and the # to %23 but the acrobat preview is not working due to the %23 that it thinks is part of the file name.
Hope I make sense please ask if you do not understand.