Support DJVU search by content
-
- Posts: 1
- Joined: Fri Mar 15, 2024 9:10 pm
Support DJVU search by content
I (and many users) have lots of djvu books, I need to search in their contents like I do with pdf or txt. If I open them (with for example Okular, or another djvu viewer) I can search for words in them. However, neither windows search, nor Everything, allows me to search by content any DJVU. I believe this could be a easy feature since the djvu has a defined text layer.
Re: Support DJVU search by content
I have added: support DJVU to my TODO list.
Thank you for the suggestion.
Everything uses third party iFilters to search file content. (Like Windows Explorer)
There should be DJVU iFilters out there.
Thank you for the suggestion.
Everything uses third party iFilters to search file content. (Like Windows Explorer)
There should be DJVU iFilters out there.
-
- Posts: 504
- Joined: Thu Dec 15, 2016 9:44 pm
Re: Support DJVU search by content
I have a VBS script that runs through all my djvu & pdf files and where a .txt version is lacking it creates one, much smaller than the original, this allows me to use normal text-searching tools.
If anyone needs it I attach it below, the exe paths will need adjusting (and the exes present), they end up as .pdf.txt as I regularly have both djvu and pdf versions -
If anyone needs it I attach it below, the exe paths will need adjusting (and the exes present), they end up as .pdf.txt as I regularly have both djvu and pdf versions -
Code: Select all
Option Explicit
Dim oFs, sPth, oArgs, oShell, kCrt, kMov, kFnd
'Dim WScript As Object
Const fsReadOnly = 1, fsHid = 2, fsSystem = 4, fsDir = 16, fsArc = 32
Const fsNrm = 128, fsUnIdx = 8192, fsOffline = 4096, fsReparsePt = 1024, fsCmp = 2048, fsDev = 64, fsEnc = 16384
Const fsSparse = 512, fsTemp = 256
Main
Sub Main()
Dim i
Set oFs = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
kCrt = 0: kMov = 0: kFnd = 0
Set oArgs = WScript.Arguments
For i = 0 To oArgs.Count - 1
sPth = oArgs(i)
If sPth > "" Then
If Right(sPth, 1) <> "\" Then sPth = sPth & "\"
ScanPth oFs.GetFolder(sPth)
End If
Next
if i=0 Then
sPth=Inputbox("Path:")
if sPth>"" Then ScanPth oFs.GetFolder(sPth)
End If
MsgBox "Crt : " & kCrt & vbCrLf & "Mov : " & kMov & vbCrLf & "Fnd : " & kFnd
End Sub
Function ScanPth(oFolder) ' {
Dim oFile, sExt, oSubFolder, oFileTxt, sFileIdeal, sFileBaseDot
On Error Resume Next
' Files
For Each oFile In oFolder.Files ' {
sExt = LCase(oFs.GetExtensionName(oFile.Name))
If sExt = "pdf" Or sExt = "djvu" Then ' {
sFileBaseDot = Left(oFile.Path, Len(oFile.Path) - Len(sExt))
Set oFileTxt = Nothing
Set oFileTxt = oFs.GetFile(sFileBaseDot & "pdf.txt")
If Not oFileTxt Is Nothing Then ' { Ideal Found
kFnd = kFnd + 1
Else
Set oFileTxt = oFs.GetFile(sFileBaseDot & "txt"): If oFileTxt Is Nothing Then Set oFileTxt = oFs.GetFile(sFileBaseDot & "djvu.txt")
If Not oFileTxt Is Nothing Then ' { Non-Ideal Found
oFileTxt.Move sFileBaseDot & "pdf.txt": kMov = kMov + 1
Else ' Create
kCrt = kCrt + 1
If sExt = "pdf" Then
oShell.Run """C:\Program Files\xpdf-tools\bin64\pdftotext.exe"" """ & oFile.Path & """ """ & sFileBaseDot & "pdf.txt""", 7, -1
Else
oShell.Run """C:\Program Files (x86)\DjVuLibre\djvutxt.exe"" """ & oFile.Path & """ """ & sFileBaseDot & "pdf.txt""", 7, -1
End If
End If ' }
End If ' }
End If ' } pdf djvu
Next ' } File
' Folders
For Each oSubFolder In oFolder.SubFolders
If oSubFolder.Name > "" Then ScanPth oSubFolder
Next
End Function ' }
Re: Support DJVU search by content
This site provides a free DJVU iFilter
and also Preview.
https://www.cuminas.jp/en/downloads
in its Shell Extensions pack
https://www.cuminas.jp/en/downloads/download?pid=5
and also Preview.
https://www.cuminas.jp/en/downloads
in its Shell Extensions pack
https://www.cuminas.jp/en/downloads/download?pid=5