Welcome to the Ranch. Is this the same problem as you posted on the intermediate forum? Please don't post the same question twice. See what Fred Rosenberger has already told you. All those if something == null blocks look like a fruitful source of errors.
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