locked
Import PDF file RRS feed

  • Question

  • User-1105778986 posted

    Hi , can i help you please , how i can import pdf with asp.net ?

    Wednesday, April 26, 2017 7:24 AM

All replies

  • User-1509636757 posted

    Can you provide some more information and elaborate your requirement?

    Wednesday, April 26, 2017 8:28 AM
  • User-1105778986 posted

    oh yes , i upload a PDF file and i want to extract the data and save it on sql server

    Wednesday, April 26, 2017 9:25 AM
  • User-1509636757 posted

    Have a look to the following links:

    How to read pdf files using C# .NET

    and

    Reading PDF in C#

    Hopefully they can guide you to the correct direction.

    iTextSharp is another alternative PDF library for .NET.

    You can use Adobe PDF IFilter Library to convert a PDF document to text.

    Also see an example on the CodeProject

    Wednesday, April 26, 2017 9:49 AM
  • User-1105778986 posted

    thank's  Kaushalparik 

    Wednesday, April 26, 2017 10:07 AM
  • User2026865277 posted

    oh yes , i upload a PDF file and i want to extract the data and save it on sql server

    Hi, here is an solution based on .NET PDF component 

    //load a pdf file
    PdfDocument doc = new PdfDocument();
    doc.LoadFromFile(@"E:\example.pdf");
    
    //create an object of StringBuilder for storing extracted text
    StringBuilder sb = new StringBuilder();
    
    //create an object of List<> for storing extracted images
    IList<Image> images = new List<Image>();
    
    foreach (PdfPageBase page in doc.Pages)
    {
        sb.Append(page.ExtractText()); //extract text
        foreach (Image image in page.ExtractImages())
        {
            images.Add(image);//extract images
        }
    }
    

    Tuesday, May 2, 2017 2:47 AM
  • User1382769526 posted

    Hi

    There are number of ways to import PDF file with asp.net, but it seems you are new to asp.net so I recommend you to use ByteScout PDF SDK for this purpose as you need not to worry about any thing as everything is shipped with SDK and you just need to call methods of that SDK for your task. See the sample code for Importing PDF using C#

    // This test file will be copied to the project directory on the pre-build event (see the project properties).
                String inputFile = Server.MapPath("sample2.pdf");
     
                // Create Bytescout.PDFExtractor.TextExtractor instance
                TextExtractor extractor = new TextExtractor();
                extractor.RegistrationName = "demo";
                extractor.RegistrationKey = "demo";
                 
                // Load sample PDF document
                extractor.LoadDocumentFromFile(inputFile);
     
                Response.Clear();
                Response.ContentType = "text/html";
     
                // Save extracted text to output stream
                extractor.SaveTextToStream(Response.OutputStream);
     
                Response.End();

    Friday, December 14, 2018 7:41 AM