locked
query RRS feed

  • Question

  • User328375322 posted

    how to store pdf file without using sql connection?

    Monday, March 16, 2020 6:01 AM

All replies

  • User288213138 posted

    Hi shubhamg19,

    shubhamg19

    how to store pdf file without using sql connection?

    If you want to save the pdf file in C# without using database, you can try to save PDF file to stream.

    PdfDocument doc = new PdfDocument();                 
    FileStream to_stream = new FileStream(@"....\1.pdf", FileMode.Open);        
    doc.SaveToStream(to_stream);         
    to_stream.Close();            
    doc.Close();

    More information about Save PDF file to stream in C# you can refer to this link: https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Document-Operation/Save-PDF-file-to-Stream-and-Load-PDF-file-from-Stream-in-C-.NET.html

    Best regards,

    Sam

    Monday, March 16, 2020 7:14 AM
  • User409696431 posted

    Save the PDF file where?   It would help if you were more clear in your requirements.   An SQL connection would be required only if you wanted to save the file (or information about the file) in a database.  If you want to save it on the server, that's easy, although the full answer requires knowing how you acquired the PDF File.  Uploaded from a user of your site, using the file upload control?  Created by you on the server?   Both answers end with simply saving the file to a known location on the server.

    Monday, March 16, 2020 7:27 AM