Christopher Francisco
Christopher Francisco

Reputation: 16288

PDFSharp saving pdf to Content folder in ASP .NET MVC 5

I'm new to PDFSharp and I'm trying to save a PDF document, but when I call renderer.PdfDocument.Save(filename) it attempts to save it inside C:\Program Files\IIS Express\ and obviously it crashes out of denied permission.

How can I save the PDF document to /Content/ folder inside my MVC project?

Upvotes: 0

Views: 3931

Answers (1)

Use a function like Server.MapPath to get the absolute path of the destination folder and pass that to the Save method.

See also:
https://stackoverflow.com/a/1268755/1015447

Upvotes: 2

Related Questions