PDF to PNG - pqScan.com
.NET PDF to Text SDK Mature .NET Software for Getting Text from PDF and Converting PDF to Text File Download Trial Purchase Now

How to Extract PDF Text in ASP.NET Web

back to home  >  .NET PDF to Text SDK  >  How to Extract Text from PDF in .NET  >  PDF to Text Extraction for ASP.NET

PDF file format is widely used now. Sometimes, we may need to get text out of PDF document and use it in web applications for text editing, content management or other purposes. Then, PDF to text editor, PDF to text extractor, and PDF to text converter grow in number on software market. And pqScan .NET PDF to Text SDK for ASP.NET is one of them, superior and stable.

On this online tutorial, you will know how can .NET PDF to Text Library DLL be used in ASP.NET web application. Free sample coding below will tell you how to extract text from PDF document and show it on an aspx page.

ASP.NET PDF to Text Extraction Sample

Please note that, pqScan .NET PDF to Text Extractor is a standalone library and there's no need for installing other PDF reading or editing software into your ASP.NET project. It's very simple to use, just adding the reference from pqScan .NET PDF to Text SDK to your ASP.NET web application and using the following refined C# and VB.NET programming codes. More .NET APIs for extracting or converting PDF to text can be found on .NET PDF to Text Extraction - How to Guide.

C# Code for ASP.NET PDF to Text

using System;
using System.Web;
using PQScan.PDFToText;

public partial class _Default : System.Web.UI.Page 
{
  protected void Page_Load(object sender, EventArgs e)
  {
    // Prepare a test document.
    string pdfFileName = Server.MapPath("sample.pdf");

    // Create an instance of PQScan.PDFToText.PDFExtractor object.
    PDFExtractor pdfExtractor = new PDFExtractor();

    // Load your PDF document.
    pdfExtractor.LoadPDF(pdfFileName);

    // Extract the first page of PDF document to text.
    string text = pdfExtractor.ToText(0);

    // Prepare response.
    Response.Clear();
    Response.ContentType = "text/html";

    // Show text output on aspx web page.
    Response.Write(text);
  }
}

VB Code for ASP.NET PDF to Text

Imports System
Imports System.Web
Imports PQScan.PDFToText

Public partial Class _Default
  Inherits System.Web.UI.Page
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    ' Prepare a PDF file.
    Dim pdfFileName As String = Server.MapPath("sample.pdf") 

    ' Create an instance of PQScan.PDFToText.PDFExtractor object.
    Dim pdfExtractor As PDFExtractor = New PDFExtractor() 

    ' Load your PDF file.
    pdfExtractor.LoadPDF(pdfFileName)

    ' Extract the first page of PDF file to text.
    Dim text As String = pdfExtractor.ToText(0) 

    ' Prepare response.
    Response.Clear()
    Response.ContentType = "text/html"

    ' Show text output on aspx web page.
    Response.Write(text)
  End Sub
End Class
pqScan SDK
.NET PDF to Text Library
Online Guide
Convert PDF to Text in .NET Convert PDF to Text Using C# Convert PDF to Text Using VB
Definitely, 100% managed code .NET library with superb service! Till now, work perfectly, and save plenty of time. Joe Harvey