{file2text:url}

Description

Reads the plain-text content out of an uploaded DOC, DOCX, PDF or ODT file, so the text can be searched or indexed. The url argument is the file path or address - usually a file-field getter. The install must define the matching external converter (CONV_TEXTFILTERS_DOC, _DOCX, _PDF or _ODT); if the converter for that file type is not configured, or the extension is none of those four, the result is empty. Output is runtime-dependent and never cached. Typical use: a Computed field stores the extracted text so an ordinary text search finds words inside attachments.

Parameters

url required

File path or address of the DOC, DOCX, PDF or ODT file to read - usually a file-field getter like {file............}. A relative path is resolved against the current server; an http(s):// address is fetched. The extension decides which converter runs; an unmatched extension or an unconfigured converter yields empty output.

Examples

test[{file2text:}]
Expected[]
Actual[]
With no file given there is nothing to read, so the result is an empty string. The brackets just make the empty output visible.
virtual{file2text:https://example.org/files/report.pdf}
Expected(the text of report.pdf, e.g. "Annual report 2025 ...")
Give an absolute address and the file is downloaded, then read. Put a call like this in a Computed field so the documents words are stored alongside the item; an ordinary text search then matches content inside the PDF.
virtual{convert:{file2text:{file............}}:utf-8:windows-1250}
Expected(the extracted text, transcoded from utf-8 to windows-1250)
The converter returns UTF-8 text. Wrap it in {convert:..:from:to} when the field that stores the result expects a different character set, for example windows-1250.
virtual{file2text:{file............}}
Expected(the plain text extracted from the uploaded file)
The common pattern: pass a file-field getter so the command reads whichever document the editor uploaded. The actual output is the documents extracted text, which depends on the uploaded file and on the installs configured converter.
test[{file2text:notes.txt}]
Expected[]
Actual[]
Only DOC, DOCX, PDF and ODT are recognised. A .txt (or any other extension) matches no converter, so the output is empty - no file is fetched or run.