Answers.Body: <p>First, use the <code>djvutoxml</code> tool to extract a text layer in XML format from the DjVu document.</p>
  
  <p>At the command prompt, type:</p>
  
  <pre><code>path\djvutoxml.exe path\book.djvu path\book.xml
  </code></pre>
  
  <p>Instead <code>path</code> parameter substitute your location on the disk.</p>
  
  <p>Press Enter...</p>
  
  <hr>
  
  <p>Then, using the <em>regular expressions</em>, remove the selected characters<br>(placed between sharp brackets <code>&gt; &lt;</code>). You can use any text editor (that can do regex).</p>
  
  <p>String to remove spaces:</p>
  
  <pre><code>&lt;WORD&gt;&lt;CHARACTER coords="\d*,\d*,\d*,\d*"&gt; &lt;/CHARACTER&gt;&lt;/WORD&gt;
  </code></pre>
  
  <p>String to remove tabs:</p>
  
  <pre><code>&lt;WORD&gt;&lt;CHARACTER coords="\d*,\d*,\d*,\d*"&gt;&amp;#9;&lt;/CHARACTER&gt;&lt;/WORD&gt;
  </code></pre>
  
  <p>Regular expression can also be written in this form. This deletes everything at once:</p>
  
  <pre><code>&lt;WORD&gt;&lt;CHARACTER coords="([0-9,]*?)"&gt;(&amp;#9;| )&lt;/CHARACTER&gt;&lt;/WORD&gt; 
  </code></pre>
  
  <p>Original fragment:</p>
  
  <pre><code>&lt;WORD coords="318,262,706,190"&gt;Hallo&lt;/WORD&gt;
  &lt;WORD&gt;&lt;CHARACTER coords="707,262,760,190"&gt; &lt;/CHARACTER&gt;&lt;/WORD&gt;
  &lt;WORD coords="761,262,813,190"&gt;World!&lt;/WORD&gt;
  &lt;WORD&gt;&lt;CHARACTER coords="814,262,860,190"&gt; &lt;/CHARACTER&gt;&lt;/WORD&gt;
  </code></pre>
  
  <p>Fixed fragment:</p>
  
  <pre><code>&lt;WORD coords="318,262,706,190"&gt;Hallo&lt;/WORD&gt;
  [here was the code for the space]
  &lt;WORD coords="761,262,813,190"&gt;World!&lt;/WORD&gt;
  [here was the code for the space]
  </code></pre>
  
  <p>(You can see how large text strings have been removed. Here <strong>62</strong> characters to describe one space!)</p>
  
  <p><hr>
  Finally, use the <code>djvuxmlparser</code> tool to merge modified XML with DjVu document.</p>
  
  <p>At the command prompt, type:</p>
  
  <pre><code>path\djvuxmlparser.exe -o path\final.djvu path\book.xml
  </code></pre>
  
  <p>Instead <code>path</code> parameter substitute your location on the disk.<br>
  Parameter <code>-o</code> defines the target file.</p>
  
  <p>Press Enter...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-19T21:07:14.263Z
Answers.LastActivityDate: 2018-07-19T21:07:14.263Z
Answers.UserDisplayName: Stilgar Dragonclaw
Body: <p>How to remove spaces and tabs from the text layer in DjVu document for better text search using the <a href="http://djvu.sourceforge.net/" rel="nofollow noreferrer">DjVuLibre</a> library?</p>
  
  <p>By removing unnecessary characters (and their xml tags), also the file size is reduced.</p>
  
Tags: <djvu>
Title: How to remove white space from the text layer in DjVu
UserDisplayName: Stilgar Dragonclaw
ThreadText: # How to remove white space from the text layer in DjVu
  
  (Asked by: username_0 on 2018-07-19)
  
  How to remove spaces and tabs from the text layer in DjVu document for better text search using the [DjVuLibre](http://djvu.sourceforge.net/) library?
  
  By removing unnecessary characters (and their xml tags), also the file size is reduced.
  
  **Tags:** djvu
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-07-19. Score: 1
  
  First, use the `djvutoxml` tool to extract a text layer in XML format from the DjVu document.
  
  At the command prompt, type:
  
  ```
  path\djvutoxml.exe path\book.djvu path\book.xml
  
  ```
  
  Instead `path` parameter substitute your location on the disk.
  
  Press Enter...
  
  ---
  
  Then, using the *regular expressions*, remove the selected characters  
  (placed between sharp brackets `> <`). You can use any text editor (that can do regex).
  
  String to remove spaces:
  
  ```
  <WORD><CHARACTER coords="\d*,\d*,\d*,\d*"> </CHARACTER></WORD>
  
  ```
  
  String to remove tabs:
  
  ```
  <WORD><CHARACTER coords="\d*,\d*,\d*,\d*">&#9;</CHARACTER></WORD>
  
  ```
  
  Regular expression can also be written in this form. This deletes everything at once:
  
  ```
  <WORD><CHARACTER coords="([0-9,]*?)">(&#9;| )</CHARACTER></WORD> 
  
  ```
  
  Original fragment:
  
  ```
  <WORD coords="318,262,706,190">Hallo</WORD>
  <WORD><CHARACTER coords="707,262,760,190"> </CHARACTER></WORD>
  <WORD coords="761,262,813,190">World!</WORD>
  <WORD><CHARACTER coords="814,262,860,190"> </CHARACTER></WORD>
  
  ```
  
  Fixed fragment:
  
  ```
  <WORD coords="318,262,706,190">Hallo</WORD>
  [here was the code for the space]
  <WORD coords="761,262,813,190">World!</WORD>
  [here was the code for the space]
  
  ```
  
  (You can see how large text strings have been removed. Here **62** characters to describe one space!)
  
  ---
  
  Finally, use the `djvuxmlparser` tool to merge modified XML with DjVu document.
  
  At the command prompt, type:
  
  ```
  path\djvuxmlparser.exe -o path\final.djvu path\book.xml
  
  ```
  
  Instead `path` parameter substitute your location on the disk.  
  Parameter `-o` defines the target file.
  
  Press Enter...
  
  
  ---
  
  