You need to add the run-time tunable printer_redirection=true in order for the priint output to be redirected through the Windows print spooler.
I am assuming that this is a managed code application as the error that you are receiving is a .NET exception. In a managed project you can turn this tunable on by adding a section to an app.config file.
If you right-click on your project name-->select add-->new item and select Application Configuration file from the list.
Edit the app.config file to add the run-time tunable as show in the following docs.