Open PDF files in Nitro instead of Adobe reader

jco23

Registered User.
Local time
Today, 14:14
Joined
Jun 2, 2015
Messages
64
I built an Access database app for hundreds of users.

one functionality they want is to be able to extract certain text based upon keywords from a PDF document.

my company uses Nitro Pro instead of Adobe (significantly lower cost for basically the same functionality).

I was able to achieve this by creating some logic to convert the PDF document to a text file, and then extract the text needed from that text file.

first, I use application.followhyperlink "myPDFfile" to open the file, and then use send keys to convert it to a text file.
however, this only works when Adobe is NOT installed. otherwise, the PDF opens in Adobe reader, and thus cannot complete the rest of the script. I've made sure that my default PDF program is Nitro Pro.

I've tried using a shell command such as:
dim Temp as variant
Temp = Shell("C:\Program Files\Nitro\Pro\13\NitroPDF.exe" & " " & myPDFfile, 1)
appactivate (Temp)

this logic opens the PDF in Nitro, but Nitro immediately tries to print it rather just opening it to view

thus, how can open PDF files in Nitro instead of Adobe for those users that still have Adobe reader installed as well?

thanks!
 
And you're positive your default program is Nitro for PDF extension? It seems impossible that it opens in Adobe with follow hyperlink
 
I would never recommend using sendkeys, but since you already are, would an ESC after your shell command get rid of the print dialogue?
 
And you're positive your default program is Nitro for PDF extension? It seems impossible that it opens in Adobe with follow hyperlink
100%. the Nitro icon appears next to all PDF files.
perhaps there's some sort of registry key? but I may not be able to edit it since our company locks it down.
 
I would never recommend using sendkeys, but since you already are, would an ESC after your shell command get rid of the print dialogue?
understood on sendkeys not being optimal, but it works.

i tried the sendkeys {ESC}, but that did not work either.
 
i tried the sendkeys {ESC}, but that did not work either.
I'm assuming you played around with timings, sending it >1 time, etc. as it can be finicky
And you assured that the window was totally Active when ESC was sent?
As I'm sure you've discovered appactivate can be finicky, too, but if it's working that's weird. I'm going to keep thinking on this one
 
I'm assuming you played around with timings, sending it >1 time, etc. as it can be finicky
And you assured that the window was totally Active when ESC was sent?
As I'm sure you've discovered appactivate can be finicky, too, but if it's working that's weird. I'm going to keep thinking on this one
right, I tried numerous methods, but to no avail.
i'm not giving up though.
i appreciate the follow up!
 
100%. the Nitro icon appears next to all PDF files.
perhaps there's some sort of registry key? but I may not be able to edit it since our company locks it down.

Technically, the app you use to open a file depends on something called "Associations" - but on more modern versions of Windows, it is called "Default files". There is a feature in Settings >> Apps >> Default Files (on Win 11) that lets you specify that file type .XYZ by default will run under utility program System32\XYZUtil.EXE (or something like that). It is saying that .XYZ is associated with System32\XYZUtil.Exe - and that association permeates the system for all users ... most of the time.

The question is whether the Nitro icon appears by the file on those workstations where Adobe is still installed. Usually, associations are established during app installation. The Icon that is displayed tells you what program is associated with the given file type. You see the Nitro icon on your system. Just as a quickie suggestion, on workstations where Adobe is still installed, just visually inspect whether the icons show as Nitro or Adobe.

Note two factors: If both Nitro and Adobe are installed on the same machine, the one installed LAST will probably overwrite the other's associations. AND it is possible (though unlikely) that the icon used to launch file has been modified to specify a utility to open OTHER than the system default utility for that given file type. You would have to actually open the icon and look at its properties. Further note that "ordinary" file icons are dynamically generated by Windows. The modified icons aren't technically a shortcut that doesn't point to the system default utility. These are rare but would be a case where a non-default utility would be used to open a file.

Unfortunately, I think the Shell approach is going to be the way to deal with this because ... again, technically ... an icon to launch an app IS just an obscured use of the Shell function but outside of Access. It's actually a CMD function.
 
Technically, the app you use to open a file depends on something called "Associations" - but on more modern versions of Windows, it is called "Default files". There is a feature in Settings >> Apps >> Default Files (on Win 11) that lets you specify that file type .XYZ by default will run under utility program System32\XYZUtil.EXE (or something like that). It is saying that .XYZ is associated with System32\XYZUtil.Exe - and that association permeates the system for all users ... most of the time.

The question is whether the Nitro icon appears by the file on those workstations where Adobe is still installed. Usually, associations are established during app installation. The Icon that is displayed tells you what program is associated with the given file type. You see the Nitro icon on your system. Just as a quickie suggestion, on workstations where Adobe is still installed, just visually inspect whether the icons show as Nitro or Adobe.

Note two factors: If both Nitro and Adobe are installed on the same machine, the one installed LAST will probably overwrite the other's associations. AND it is possible (though unlikely) that the icon used to launch file has been modified to specify a utility to open OTHER than the system default utility for that given file type. You would have to actually open the icon and look at its properties. Further note that "ordinary" file icons are dynamically generated by Windows. The modified icons aren't technically a shortcut that doesn't point to the system default utility. These are rare but would be a case where a non-default utility would be used to open a file.

Unfortunately, I think the Shell approach is going to be the way to deal with this because ... again, technically ... an icon to launch an app IS just an obscured use of the Shell function but outside of Access. It's actually a CMD function.
thanks for the detailed explanation.
i confirmed that the default pdf app in settings-> apps is Nitro (see attached screenshot). I doubt that I need to adjust the others?

I would be fine with the shell approach, but I don't know why Nitro thinks I want to convert a PDF to a PDF. the hard part is that there probably aren't very many Nitro users/developers. I tried posting this question to their community website, but got crickets so far.

additionally, I unchecked any Acrobat tool references in the MS Access app. there does NOT appear to be a library/reference for Nitro though. maybe that's missing?
 

Attachments

  • Capture.PNG
    Capture.PNG
    15.2 KB · Views: 18
Just thought of something. I think followhyperlink will try to use the browser PDF viewer that's set...
@The_Doc_Man OP mentioned they already set the default program

Try making sure NitroPDF is set as your browser viewer and it might make a difference?

My local test of the shell command ALSO tried to immediately print the pdf doc, instead of just opening :mad:
 
Isaac is right. I just checked my own browser. I use Firefox, so for Firefox,

Open any ordinary page or just launch without a specific page.
Open the browser's app menu. (Firefox: Upper right, looks like three horizontal bars).
Find Settings and click that.
Scroll down to Files and Applications.
Beneath that is Applications, which is a table that lists file type and what utility to use.

I'm pretty sure that the other browsers will have similar abilities, so I agree with Isaac. Check what your browser thinks is the default for that file type. I know that in my case, Firefox has a PDF reader built-in that it uses for Adobe files, but it is possible that the Adobe installation process would want to update your browser if it recognized it.
 
and since there are still some (a tiny bit, I think?) some Windows things that for some ungodly reason are tied in to Internet Explorer, it could be either
1) make sure I.E. settings are as Doc said
2) make sure your Default Browser's settings are as Doc said

..not sure which
 
Just thought of something. I think followhyperlink will try to use the browser PDF viewer that's set...
@The_Doc_Man OP mentioned they already set the default program

Try making sure NitroPDF is set as your browser viewer and it might make a difference?

My local test of the shell command ALSO tried to immediately print the pdf doc, instead of just opening :mad:
that's a good thought, and just now tried that, but no changes. i have FireFox, Chrome, Edge (Default). I did not see a setting in Edge to change the default PDF app (only whether or not to open an online PDF vs. downloading it).
this is very frustrating....
I am noticing that Adobe Reader DC (Free) works better for the text conversion, so I'm going to try to convince management to get that installed for everyone. hopefully that will be the alternative (which is the preferred method, but still doesn't solve Nitro).
thanks again for the responses!
 
Glad you got a potential path forward.
That is, theoretically, somewhere hidden in that site is the specific documentation on command line programming, which would give you the correct shell command to open rather than print. May or may not be the time to spend combing through it but just thought I'd throw it up there.

You can see from this thread
that there is definitely a way to do all the command lines, you just have to find which one is to simply open rather than default to print.

In that community a posted question would probably result in the answer if you feel like going that route.
 

Users who are viewing this thread

Back
Top Bottom