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