We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with pdf.Save(string pdfFile) - C#


I am using C# and VS2005 to create a component which converts TIF files retrieved from a SharePoint library into PDF using Aspose PDF and I am having some trouble with the pdf.Save(string pdfFile) method. I am trying to save these files to the file system so that they can be attached to an email. What is the proper syntax for the pdfFile parameter? Should it be a path or a simple file name? When I pass the string "c:\\test.pdf" I get the following error message, although my user has proper access to the C drive.

The remote server returned an error: (401) Unauthorized.

If I attempt to pass the server name with the path, I get the same error:


What am I doing wrong?

Thank you for your help.


Thanks for using our products.

For Pdf.Save(..) method you can provide the complete file path including folder location, and in case you simply provide the file name without complete folder location, the resultant file will be saved over the application execution path. As far as it's related to the current error message, your application does not seem to have access to save the resultant PDF over specified path. Can you please again check the access rights over specific server and provide full rights to EVERYONE group.

However, as per your requirement of sending the resultant PDF as an attachment via an email, you can save the resultant PDF in a MemoryStream object and simply use it to attach with an email. Please take a look over the following link for more information regarding overloaded methods of Pdf.Save(...)


In case your problem is not resolved or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi there, I’m having a similar problem. I’m using VB and VS2005 to create a PDF consisting of several jpegs and tables. I’m binding an XML file to my PDF object, and filling in the values in my VB code. I am then opening the PDF in Acrobat the following way:

Dim reportPath As String = “Report” + Date.Now.Ticks.ToString + ".pdf"
p.Save(reportPath, Aspose.Pdf.SaveType.OpenInAcrobat, Response)

I am having success when I do this on my local build, but when I move this to my staging environment, I get the same System.Net.WebException error “The remote server returned an error: (401) Unauthorized” error on the p.Save operation. Since I am opening the PDF in Acrobat, the file should not be getting saved to disk, so I don’t see why this would be a folder permissions issue. Do you have any thoughts?

Thanks for your help.

Ah, never mind, it was an issue with .htaccess in the app root.