locked
use iTextSharp to save pdf to Network drive RRS feed

  • Question

  • User795060343 posted

    Hello,

    I'm using iTextSharp to convert part of the page to pdf and save it in a folder.

    Now I want the pdfs to be saved in a Network Folder (shared drives in the office)

    This is the code I'm using and it's working fine to save in project folder:

    PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(Server.MapPath("~/PDFDocuments/employee_" + signature.Text + "_" + ID + ".pdf"), FileMode.CreateNew));
    

    Wednesday, August 19, 2015 2:48 AM

Answers

  • User-821857111 posted

    Provide the full UNC path to the FileStream constructor:

    var uncPath = @"\\YourServer\YourFolder\YourSubfolder\employee_"+ signature.Text + "_" + ID + ".pdf";
    PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(uncPath, FileMode.CreateNew));

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 19, 2015 3:27 AM

All replies

  • User-821857111 posted

    Provide the full UNC path to the FileStream constructor:

    var uncPath = @"\\YourServer\YourFolder\YourSubfolder\employee_"+ signature.Text + "_" + ID + ".pdf";
    PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(uncPath, FileMode.CreateNew));

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 19, 2015 3:27 AM
  • User795060343 posted

    Thank you for your useful reply. It's working fine now.

    Wednesday, August 19, 2015 4:24 AM