Pdfwriter

View: New views
1 Messages — Rating Filter:   Alert me  

Pdfwriter

by HuaMin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I've got the following issue with the line in bold below.
            Font times = new Font(bfTimes, 22, Font.BOLD, Color.BLACK);

            string newFile = @"c:\file1.pdf";
            Document doc = new Document();
            PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(newFile, FileMode.Create));
            // Metadata
            doc.AddTitle("File of " + Session["sv_nm"]);
            // Add content
            doc.Open();
            ...
            doc.Close();
            PdfEncryptor.Encrypt(new PdfReader(newFile),new FileStream
            (newFile, FileMode.Open), PdfWriter.STRENGTH128BITS, pswd, null, PdfWriter.AllowScreenReaders);


IOException was unhandled by user code
The process cannot access the file 'c:\file1.pdf' because it is being used by another process.


--------------------------------------------------------------------------------
Many Thanks & Best Regards, HuaMin Chen