PDF to Text in .NET

This page describes how to use our cloud-based API to convert PDF to text in .NET. The API is user-friendly and can be integrated into your application with just a few lines of code.

Installation

The .NET API client library provides easy access to the Pdfcrowd API. No third-party libraries are required.

Download pdfcrowd-5.13.0-dotnet.zip, unzip it and add a reference to pdfcrowd.dll to your project.

We also offer other installation options such as NuGet or GitHub.

Authentication

The credentials to access the API are your Pdfcrowd username and the API key. You can try out the API without registering using the following demo credentials:

  • Username: demo
  • API key: ce544b6ea52a5621fb9d55f8b542d14d

To get your personal API credentials, you can start a free API trial or buy the API license.

API Method Reference

Refer to the PDF to Text .NET Reference for a description of all API methods.

Code Examples

Here are a few .NET examples to get you started quickly with the API. See more examples.

using System;
using System.IO;

public class ApiTest
{
    public static void Main()
    {
        try
        {
            // create the API client instance
            pdfcrowd.PdfToTextClient client =
                new pdfcrowd.PdfToTextClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d");

            // run the conversion and write the result to a file
            client.convertFileToFile("/path/to/invoice.pdf", "invoice.txt");
        }
        catch(pdfcrowd.Error why)
        {
            // report the error
            System.Console.Error.WriteLine("Pdfcrowd Error: " + why);

            // rethrow or handle the exception
            throw;
        }
    }
}
using System;
using System.IO;

public class ApiTest
{
    public static void Main()
    {
        try
        {
            // create the API client instance
            pdfcrowd.PdfToTextClient client =
                new pdfcrowd.PdfToTextClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d");

            // run the conversion and write the result to a file
            client.convertUrlToFile("https://pdfcrowd.com/static/pdf/apisamples/invoice.pdf", "invoice.txt");
        }
        catch(pdfcrowd.Error why)
        {
            // report the error
            System.Console.Error.WriteLine("Pdfcrowd Error: " + why);

            // rethrow or handle the exception
            throw;
        }
    }
}
using System;
using System.IO;

public class ApiTest
{
    public static void Main()
    {
        try
        {
            // create the API client instance
            pdfcrowd.PdfToTextClient client =
                new pdfcrowd.PdfToTextClient("demo", "ce544b6ea52a5621fb9d55f8b542d14d");

            // run the conversion and write the result to a file
            client.convertRawDataToFile(File.ReadAllBytes("/path/to/hello_world.pdf"), "invoice.txt");
        }
        catch(pdfcrowd.Error why)
        {
            // report the error
            System.Console.Error.WriteLine("Pdfcrowd Error: " + why);

            // rethrow or handle the exception
            throw;
        }
    }
}

Troubleshooting