Programmatically determine AcroRd32.exe path and print it !
How do i find the ins开发者_如何学Pythontalled 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.
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
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.
精彩评论