# Text search in docx and pdf files

**URL:** <https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928>\
**Category:** General\
**Created:** [16 December 2024 08:22 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928 "2024-12-16T08:22:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexander77](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@alexander77](https://discourse.nodered.org/u/alexander77)\
**Post date:** [16 December 2024 08:22 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/1 "2024-12-16T08:22:13Z")

</div>

Hi,  
i am looking for a node that acts like the F3 function in an pdf document. The purpose is to search for keywords in an bunch of technical documents available as pdf or docx.

---

<div class="post-metadata">

**Author:** ![alexander77](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@alexander77](https://discourse.nodered.org/u/alexander77)\
**Post date:** [16 December 2024 08:25 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/2 "2024-12-16T08:25:23Z")

</div>

Sorry, pressed the return key too early.  
I searched in the forum and found a hint to the switch node and a post regarding the text search in log files. I tried to find something in the flows section but maybe i used wrong keywords, englisch is not my first language.

Any hints available?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 December 2024 08:57 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/3 "2024-12-16T08:57:46Z")

</div>

You can install the [node-red-contrib-pdf-reader](https://flows.nodered.org/node/node-red-contrib-pdf-reader) node.

Use a file read node, set it to output buffer, run it through the pdf node and attach a debug node.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 December 2024 21:30 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/4 "2024-12-16T21:30:39Z")

</div>

Both of those types of files are binary not text, so you need something that can either peer inside the binary for embedded text or that can convert it to something simpler.

`docx` files are actually largely zipped XML. So you could simply unzip them and search as text but you would likely get a bunch of hard to understand XML code as well. Otherwise, you should look for a node.js library capable of parsing a docx and then use its API to search.

Alternatively, use something like the CLI Pandoc tool to covert to simpler and more easily parsed text.

---

<div class="post-metadata">

**Author:** ![alexander77](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@alexander77](https://discourse.nodered.org/u/alexander77)\
**Post date:** [17 December 2024 09:34 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/5 "2024-12-17T09:34:37Z")

</div>

@bakman2: thank you, i tried it with 3 different pdf's. Always get the message 'FieldError: Missing payload data'  
There are more pdf-nodes available, will try something else.

@Totallyinformation: Very useful information, indeed! Will follow this branch of development!

---

<div class="post-metadata">

**Author:** ![alexander77](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@alexander77](https://discourse.nodered.org/u/alexander77)\
**Post date:** [17 December 2024 11:03 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/6 "2024-12-17T11:03:21Z")

</div>

@bakman: pdf hummus does a much better job

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 December 2024 13:17 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/7 "2024-12-17T13:17:54Z")

</div>

> [@alexander77](#):
>
> Will follow this branch of development!

There appear to be a few node.js libraries such as [pdf-parse - npm](https://www.npmjs.com/package/pdf-parse)

Should be usable with a function node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 March 2025 13:18 UTC](https://discourse.nodered.org/t/text-search-in-docx-and-pdf-files/93928/8 "2025-03-17T13:18:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
