What OS you are using? If Windows is a System Variable mapped to its installation location? If so you can try Environmental Variables. If it's not mapped then read the path variable and search for "Postgres" (or any such string you see the variable is set to). It might get you to where Postgres is installed.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com