title_body: How to remove white space from the text layer in DjVu How to remove spaces and tabs from the text layer in DjVu document for better text search using the DjVuLibre library?
  
  By removing unnecessary characters (and their xml tags), also the file size is reduced.
upvoted_answer: 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 &gt; &lt;). You can use any text editor (that can do regex).
  
  String to remove spaces:
  
  &lt;WORD&gt;&lt;CHARACTER coords="\d*,\d*,\d*,\d*"&gt; &lt;/CHARACTER&gt;&lt;/WORD&gt;
  
  
  String to remove tabs:
  
  &lt;WORD&gt;&lt;CHARACTER coords="\d*,\d*,\d*,\d*"&gt;&amp;#9;&lt;/CHARACTER&gt;&lt;/WORD&gt;
  
  
  Regular expression can also be written in this form. This deletes everything at once:
  
  &lt;WORD&gt;&lt;CHARACTER coords="([0-9,]*?)"&gt;(&amp;#9;| )&lt;/CHARACTER&gt;&lt;/WORD&gt; 
  
  
  Original fragment:
  
  &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;
  
  
  Fixed fragment:
  
  &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]
  
  
  (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...