Based on your comments, the file is being created, but in the
bin\Debug
folder under your project. You want the file to be created in a specific path.
The problem is that you've only specified a
relative path in the
FileStream
constructor:
new FileStream("test.pdf",FileMode.Create)
This path will be resolved relative to the current path, which is usually the same as the path from which the application is running. In other words, the
bin\Debug
path under your project.
To save to a specific path, you'll need to pass the full path to the
FileStream
constructor:
new FileStream(@"C:\Your\Path\Here\test.pdf",FileMode.Create)
NB: Be careful trying to save the document to the root of your
C:
drive; most applications won't have permission to write to that directory. Make sure you chose a path to which your application has write permissions.