Microsoft has done a bit of magic in SharePoint so that libraries appear as Windows network shares for clients. That way, your program can simply save the file in a UNC path.
So, if you are logged in as a user with library permissions and the library URL is http://SHAREPOINT/Department/Files/(for example), you can simply save or copy the PDF files to \\SHAREPOINT\Department\Files\.
ewall source
share