error System.unathorized access to path(hdd) how to solve it

May 9 2019 1:38 PM
sing System;
using System.Windows.Forms;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace Electronic_Book
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void CreateButton_Click(object sender, EventArgs e)
{
Document doc = new Document(PageSize.A4, 20f, 20f, 30f, 30f);
PdfWriter writer = PdfWriter.GetInstance (doc, new FileStream("C:\\Users", FileMode.Create));
doc.Open();
Paragraph pGraph = new Paragraph(richTextBox.Text);
doc.Add(pGraph);
doc.Close();
}
}
}
 
 
on the line saying
 
PdfWriter writer = PdfWriter.GetInstance (doc, new FileStream("C:\\Users", FileMode.Create));
 
am getting an error saying system.unathorized access to path , i am been denied to write to my own hard drive so i tried to change the security settings of the hard drive on the properties tab
to everyone full control it did not work, i did the same for individual folders it did not work too now i am out of options can someone please help me out and thanks

Answers (2)