Products Technologies Demo Docs Blog Support Company

Using the TX Text Control Document Viewer in a React Application

This article shows how to use the TX Text Control Document Viewer in a React application. The Document Viewer is a powerful, web-based document viewing and editing component that is based on TX Text Control.

Using the TX Text Control Document Viewer in a React Application

Prerequisites

There are two ways to evaluate the TX Text Control Document Viewer. You can either host your own backend by downloading the trial version of TX Text Control .NET Server, or by creating a trial access token to use a hosted backend, valid for 30 days:

Creating the React Application

This tutorial shows how to create your first Angular application using the TX Text Control Document Viewer.

Prerequisites

  1. Create your free trial access token here:

    Create Access Token

  2. Install Node.js® and npm, if not done before.

  3. Open a Command Prompt and install the create-react-app globally by typing in the following command:

    npm install -g create-react-app

Setting up the Application

  1. Open a Command Prompt and create a new React application by typing in the following command:

    npx create-react-app my-tx-document-viewer-app
  2. Change into the newly created directory:

    cd my-tx-document-viewer-app
  3. Install the TX Text Control package:

    npm install --save @txtextcontrol/tx-react-document-viewer
  4. Open this folder in Visual Studio Code using this command:

    code .
  5. Open the src/App.js file and replace the content with the following code:

    import DocumentViewer from '@txtextcontrol/tx-react-document-viewer'
    
    function App() {
      return (
        <DocumentViewer
          width="1000px"
          height="800px"
          basePath="https://backend.textcontrol.com?access-token=your_trial_token"
          documentData="SGVsbG8gdGhlcmU=">
        </DocumentViewer>
      );
    }
    
    export default App;

    Replace your_trial_token with your actual access token you created at the beginning of this tutorial.

Running the Application

  1. Start the application by typing in the following command:

    npm start

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ReactDocument ViewerLoading

Loading Documents in React Document Viewer

This article explains how to load documents into the React Document Viewer by selecting values from a drop-down list. The drop-down list is populated with the values that then loaded into the…


AngularASP.NETJavaScript

Building an ASP.NET Core Backend Application to Host the Document Editor and…

This article explains how to create an ASP.NET Core backend application to host the Document Editor and Document Viewer. This backend application is required to provide the required functionality…


ASP.NETReactDocument Editor

TX Text Control React Packages Released

We are very happy to announce the immediate availability of React packages for TX Text Control. The new packages are available on npm and provide a wide range of document processing features…


ASP.NETASP.NET CoreDocument Viewer

High-Performance Text Replacement in Large DOCX Files using C# .NET

Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…


ASP.NETASP.NET CoreDocument Viewer

Document Viewer 33.2.1 Released: New Event and Bug Fixes

This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…