<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>pdf text extraction on Document Processing REST APIs | GroupDocs Cloud</title>
    <link>https://blog-qa.groupdocs.cloud/tag/pdf-text-extraction/</link>
    <description>Recent content in pdf text extraction on Document Processing REST APIs | GroupDocs Cloud</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 21 Sep 2026 14:36:45 +0000</lastBuildDate><atom:link href="https://blog-qa.groupdocs.cloud/tag/pdf-text-extraction/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Extract Text from PDF in Node.JS</title>
      <link>https://blog-qa.groupdocs.cloud/parser/extract-text-from-pdf-in-nodejs/</link>
      <pubDate>Mon, 21 Sep 2026 14:36:45 +0000</pubDate>
      
      <guid>https://blog-qa.groupdocs.cloud/parser/extract-text-from-pdf-in-nodejs/</guid>
      <description>Learn how to extract text from PDF in Node.JS with GroupDocs.Parser Cloud SDK. Step‑by‑step code, cURL calls, and installation guide, including encrypted PDFs.</description>
      <content:encoded><![CDATA[<p>Extracting text from <a href="https://docs.fileformat.com/pdf">PDF</a> files is a frequent requirement when building document‑processing pipelines, especially for search indexing or data analysis. <a href="https://products.groupdocs.cloud/parser/nodejs/">GroupDocs.Parser Cloud SDK for Node.JS</a> provides a robust library that lets you programmatically extract text from PDF in Node.JS without dealing with low‑level parsing logic. In this guide you will learn how to extract text from PDF in Node.JS using a complete code example, a cURL REST alternative, and the necessary setup steps, covering both plain and encrypted PDFs.</p>
<h2 id="extract-text-from-pdf-in-nodejs---complete-code-example">Extract Text from PDF in Node.JS - Complete Code Example</h2>
<p>The following example demonstrates how to extract text from PDF in Node.JS with GroupDocs.Parser Cloud SDK. It includes initialization, request building, execution, and saving the result to a local file.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">GroupDocsParserCloud</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#34;@groupdocs/parser-cloud&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">fs</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#34;fs&#34;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>(<span style="color:#66d9ef">async</span> () =&gt; {
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// Initialize configuration with your credentials
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">config</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">Configuration</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">clientId</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_ID&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">clientSecret</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_SECRET&#34;</span>
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// Create Parser API instance
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">parserApi</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">ParserApi</span>(<span style="color:#a6e22e">config</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// Build request to extract text from a PDF file stored in cloud storage
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">request</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">ExtractTextRequest</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">FileInfo</span>({
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">filePath</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;input.pdf&#34;</span> <span style="color:#75715e">// path to the PDF in GroupDocs cloud storage
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        })
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Execute the request
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">result</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">parserApi</span>.<span style="color:#a6e22e">extractText</span>(<span style="color:#a6e22e">request</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// result.text contains the extracted plain text
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">&#34;Extracted Text:\n&#34;</span>, <span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">text</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Save extracted text to a local file
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#a6e22e">fs</span>.<span style="color:#a6e22e">writeFileSync</span>(<span style="color:#e6db74">&#34;extracted.txt&#34;</span>, <span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">text</span>, <span style="color:#e6db74">&#34;utf8&#34;</span>);
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">&#34;Text saved to extracted.txt&#34;</span>);
</span></span><span style="display:flex;"><span>    } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">error</span>(<span style="color:#e6db74">&#34;Error extracting text:&#34;</span>, <span style="color:#a6e22e">error</span>);
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>})();
</span></span></code></pre></div><blockquote>
<p><strong>Note:</strong> This code example demonstrates the core functionality. Before using it in your project, make sure to update any file paths and configuration values to match your actual environment, verify that all required dependencies are properly installed, and test thoroughly in your development environment. If you encounter any issues, please refer to the <a href="https://docs.groupdocs.cloud/parser/">official documentation</a> or reach out to the <a href="https://forum.groupdocs.cloud/c/parser/19">support team</a> for assistance.</p>
</blockquote>
<h2 id="retrieve-pdf-text-using-curl-and-the-rest-api">Retrieve PDF Text Using cURL and the REST API</h2>
<p>If you prefer a language‑agnostic approach, you can achieve the same result with cURL commands that call the GroupDocs.Parser Cloud REST API. The steps below show how to authenticate, upload a PDF, extract its text, and download the result.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># 1. Get an access token</span>
</span></span><span style="display:flex;"><span>curl -X POST <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/auth/token&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -d <span style="color:#e6db74">&#39;{&#34;client_id&#34;:&#34;YOUR_CLIENT_ID&#34;,&#34;client_secret&#34;:&#34;YOUR_CLIENT_SECRET&#34;}&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Response contains &#34;access_token&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 2. Upload the PDF to cloud storage</span>
</span></span><span style="display:flex;"><span>curl -X PUT <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/storage/file/input.pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/pdf&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     --data-binary @input.pdf
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 3. Extract text from the uploaded PDF</span>
</span></span><span style="display:flex;"><span>curl -X POST <span style="color:#e6db74">&#34;https://api.groupdocs.cloud/v2.0/parser/extractText&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Authorization: Bearer YOUR_ACCESS_TOKEN&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -H <span style="color:#e6db74">&#34;Content-Type: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -d <span style="color:#e6db74">&#39;{&#34;fileInfo&#34;:{&#34;filePath&#34;:&#34;input.pdf&#34;}}&#39;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>     -o result.json
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 4. Save the extracted text locally</span>
</span></span><span style="display:flex;"><span>jq -r <span style="color:#e6db74">&#39;.text&#39;</span> result.json &gt; extracted.txt
</span></span></code></pre></div><p>These commands perform the same <strong>extract text from PDF in Node.JS</strong> operation, but through the cloud API, making it easy to integrate with any platform. For more details, see the <a href="https://reference.groupdocs.cloud/parser/">official API reference</a>.</p>
<h2 id="breaking-down-extract-text-from-pdf-in-nodejs">Breaking Down Extract Text from PDF in Node.JS</h2>
<p>Understanding each part of the code helps you adapt it to more complex scenarios, such as processing scanned or encrypted PDFs.</p>
<ol>
<li>
<p><strong>Configuration Initialization</strong> -</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">config</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">Configuration</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">clientId</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_ID&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">clientSecret</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;YOUR_CLIENT_SECRET&#34;</span>
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><p>This creates a configuration object that holds your authentication credentials. The class is documented in the <a href="https://reference.groupdocs.cloud/parser/Configuration">API reference</a>.</p>
</li>
<li>
<p><strong>Parser API Instance</strong> -</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">parserApi</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">ParserApi</span>(<span style="color:#a6e22e">config</span>);
</span></span></code></pre></div><p>The <code>ParserApi</code> class provides methods for all parsing operations, including <code>extractText</code>.</p>
</li>
<li>
<p><strong>Building the ExtractTextRequest</strong> -</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">request</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">ExtractTextRequest</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">fileInfo</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">GroupDocsParserCloud</span>.<span style="color:#a6e22e">FileInfo</span>({
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">filePath</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;input.pdf&#34;</span>
</span></span><span style="display:flex;"><span>    })
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><p><code>ExtractTextRequest</code> tells the service which file to process. You can also set OCR options here for scanned PDFs.</p>
</li>
<li>
<p><strong>Executing the Request</strong> -</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">result</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">parserApi</span>.<span style="color:#a6e22e">extractText</span>(<span style="color:#a6e22e">request</span>);
</span></span></code></pre></div><p>The <code>extractText</code> method sends the request to the cloud and returns a response object containing the plain text.</p>
</li>
<li>
<p><strong>Handling the Result</strong> -</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">&#34;Extracted Text:\n&#34;</span>, <span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">text</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">fs</span>.<span style="color:#a6e22e">writeFileSync</span>(<span style="color:#e6db74">&#34;extracted.txt&#34;</span>, <span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">text</span>, <span style="color:#e6db74">&#34;utf8&#34;</span>);
</span></span></code></pre></div><p>The <code>result.text</code> property holds the extracted content, which you can log, store, or further process.</p>
</li>
</ol>
<h2 id="installing-and-configuring-groupdocsparser-cloud-sdk-for-nodejs">Installing and Configuring GroupDocs.Parser Cloud SDK for Node.JS</h2>
<p>Before you can run the code, install the SDK and set up your environment.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npm install groupdocs-parser-cloud
</span></span></code></pre></div><p><em>Prerequisites</em>: Node.js 14 or later, an active GroupDocs Cloud account, and client credentials (client ID and client secret). Download the latest package from the <a href="https://releases.groupdocs.cloud/parser/nodejs/">official download page</a>. After installation, create a <code>config.json</code> (or use environment variables) to store your credentials securely.</p>
<h2 id="conclusion">Conclusion</h2>
<p>Extracting text from PDF in Node.JS becomes straightforward with the <a href="https://products.groupdocs.cloud/parser/nodejs/">GroupDocs.Parser Cloud SDK for Node.JS</a>. The SDK abstracts the complexity of PDF parsing, supports OCR for scanned PDFs, and handles encrypted documents out of the box. Remember to obtain a valid license for production use; you can purchase a subscription or request a <a href="https://purchase.groupdocs.cloud/temporary-license/">temporary license</a> to evaluate the library. With the code example, cURL alternative, and installation steps covered, you&rsquo;re ready to integrate PDF text extraction into your document workflow and unlock powerful search and analytics capabilities.</p>
<h2 id="faqs">FAQs</h2>
<ul>
<li>
<p><strong>How do I extract text from PDF in Node.JS using GroupDocs.Parser?</strong><br>
Use the <code>extractText</code> method of <code>ParserApi</code> as shown in the complete code example. The SDK automatically returns plain text, and you can enable OCR for scanned PDFs.</p>
</li>
<li>
<p><strong>Can I extract text from scanned PDF in Node.JS?</strong><br>
Yes. Set OCR options in the <code>ExtractTextRequest</code> to let the service recognize text on image‑based pages.</p>
</li>
<li>
<p><strong>What if my PDF is password protected?</strong><br>
Include the password in the <code>FileInfo</code> object (<code>password: &quot;yourPassword&quot;</code>). The SDK will decrypt the file before extracting text.</p>
</li>
<li>
<p><strong>Is there a way to call the service without writing Node.JS code?</strong><br>
Absolutely. The cURL commands in the &ldquo;Retrieve PDF Text Using cURL and the REST API&rdquo; section demonstrate a language‑agnostic approach via the REST API.</p>
</li>
</ul>
<h2 id="read-more">Read More</h2>
<ul>
<li><a href="https://blog.groupdocs.cloud/parser/extract-text-from-pdf-in-nodejs/">Extract Text from PDF in Node.js | Text Extraction API with REST</a></li>
<li><a href="https://blog.groupdocs.cloud/parser/extract-images-from-pdf-in-nodejs-image-extractor/">Extract Images from PDF in Node.js | PDF Image Extractor with REST API</a></li>
<li><a href="https://blog.groupdocs.cloud/parser/extract-text-from-pdf-using-csharp/">Extract Text from PDF with C# .NET</a></li>
</ul>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
