0

How do i find the installed adobe path on the system through .net code. Later this path needs to be sent as a parameter to a function which prints a pdf document...The later part is handled.

But my question is the print needs to be handled any system, but since I hard coded the adobe path according to my system it doesn't work on other systems with different versions of adobe.

I needed a solution to make adobe file compatible on any system.

skaffman
  • 398,947
  • 96
  • 818
  • 769
  • 1
    Do you want to know where acrobat reader is, or where the preferred pdf reader is? I for one have no acrobat reader installed at all because I prefer other pdf readers. – CodesInChaos May 13 '11 at 07:36

2 Answers2

1

You could use the FileAssociationInfo class to find out information about the application handling .pdf files.

This SO question has an example querying the icon, you should be able to adapt it to query the application pa

Community
  • 1
  • 1
Ben
  • 20,737
  • 12
  • 71
  • 115
0

There is also another SO question covering your problem with a slightly different approach. Don't try to get the path by yourself, use the operating system that already knows how to handle pdfs:

Process p = new Process( );
p.StartInfo = new ProcessStartInfo( )
{
    CreateNoWindow = true,
    Verb = "print",
    FileName = path //put the correct path here
};
p.Start( );

This short snippet uses the operating system to determine which application is able to print the file. Besides PDF you can use this snippet for various file types.

Community
  • 1
  • 1
PVitt
  • 11,500
  • 5
  • 51
  • 85