### Installation: Configuring Character Set Mapping Files Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Instructions for configuring character set mapping files and font names after installation. ```APIDOC ## Installation - Configuring Character Set Mapping Files ### Description Instructions for placing character set mapping files and font name configuration files in the correct locations after compiling and installing antiword. ### Method File copying commands. ### Endpoint N/A ### Parameters None ### Request Example ```bash # Create user configuration directory mkdir -p $HOME/.antiword # Copy mapping files and font names to user config directory cp antiword-0.37/Resources/*.txt $HOME/.antiword/ cp antiword-0.37/Resources/fontnames $HOME/.antiword/ # Alternatively, install to system directory (requires root privileges) sudo mkdir -p /usr/share/antiword sudo cp antiword-0.37/Resources/*.txt /usr/share/antiword/ sudo cp antiword-0.37/Resources/fontnames /usr/share/antiword/ ``` ### Response #### Success Response Character set mapping files and font names are correctly configured. #### Response Example (Configuration files placed in the appropriate directory) ``` -------------------------------- ### Installation: Compiling antiword Executable Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Instructions for compiling the antiword executable from source code on various operating systems. ```APIDOC ## Installation - Compiling antiword Executable ### Description Instructions for compiling the antiword executable from source code using Makefiles provided for different operating systems. ### Method Command-line compilation. ### Endpoint N/A ### Parameters None ### Request Example ```bash # Navigate to the source directory cd antiword-0.37 # Compile on Linux systems make -f Makefile.Linux # Or use default make after copying the appropriate Makefile cp Makefile.Linux Makefile make make install # Supported Makefiles for other platforms: # Makefile.Solaris - Solaris systems # Makefile.HP-UX - HP-UX systems # Makefile.IRIX - IRIX systems # Makefile.cygwin - Cygwin environment # Makefile.dos - DOS systems ``` ### Response #### Success Response Compiled antiword executable and installation. #### Response Example (Executable installed, typically in `/usr/local/bin`) ``` -------------------------------- ### Configure antiword Character Set Mapping Files Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Steps to configure character set mapping files for antiword, either for user-specific settings in `$HOME/.antiword` or system-wide installation. ```bash # Create user configuration directory mkdir -p $HOME/.antiword # Copy mapping files and font names cp antiword-0.37/Resources/*.txt $HOME/.antiword/ cp antiword-0.37/Resources/fontnames $HOME/.antiword/ # Or install to system directory (requires root privileges) sudo mkdir -p /usr/share/antiword sudo cp antiword-0.37/Resources/*.txt /usr/share/antiword/ sudo cp antiword-0.37/Resources/fontnames /usr/share/antiword/ ``` -------------------------------- ### Compile antiword Executable on Linux Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Instructions for compiling the antiword C executable on Linux systems using the provided Makefile. Includes steps for installation. ```bash # Enter the source directory cd antiword-0.37 # Compile on Linux system make -f Makefile.Linux # Or use default make (requires copying the appropriate Makefile first) cp Makefile.Linux Makefile make make install # Other supported platforms: # Makefile.Solaris - Solaris system # Makefile.HP-UX - HP-UX system # Makefile.IRIX - IRIX system # Makefile.cygwin - Cygwin environment # Makefile.dos - DOS system ``` -------------------------------- ### Compile antiword Executable Source: https://github.com/baituhuangyu/antiword-python/blob/master/README.md Compile the antiword executable from source. Ensure you are compiling for your specific operating system. ```bash cd antiword-0.37 make make install ``` -------------------------------- ### Antiword CLI: XML Output (DocBook) Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Generate XML output, specifically DocBook format, from Word documents. This is ideal for scenarios requiring structured data extraction. ```bash # Convert to DocBook XML format antiword -x db document.doc > output.xml ``` -------------------------------- ### antiword Command-Line Tool: Image Processing Options Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Options to control how images are handled in PostScript output. ```APIDOC ## antiword Command-Line Tool - Image Processing Options ### Description Controls the level of image processing in the PostScript output. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-i [LEVEL]** (integer) - Specifies the image processing level for PostScript output. - `1`: Do not display images. - `2`: PostScript Level 2 compatibility (default). - `3`: PostScript Level 3 compatibility (experimental). - `0`: Use Ghostscript non-standard extensions (for screen display only). ### Request Example ```bash # Do not display images in PostScript output antiword -p a4 -i 1 document.doc > output.ps # Use PostScript Level 2 compatibility (default) antiword -p a4 -i 2 document.doc > output.ps # Use PostScript Level 3 compatibility (experimental) antiword -p a4 -i 3 document.doc > output.ps # Use Ghostscript non-standard extensions for screen display antiword -p a4 -i 0 document.doc > output.ps ``` ### Response #### Success Response PostScript content of the Word document with specified image handling, redirected to a file. #### Response Example (PostScript data written to `output.ps`) ``` -------------------------------- ### Antiword CLI: Image Processing Options Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Control how images are handled in PostScript output using the -i option. Options range from not displaying images to experimental Level 3 compatibility. ```bash # Do not display images antiword -p a4 -i 1 document.doc > output.ps ``` ```bash # PostScript Level 2 compatibility (default) antiword -p a4 -i 2 document.doc > output.ps ``` ```bash # PostScript Level 3 compatibility (experimental) antiword -p a4 -i 3 document.doc > output.ps ``` ```bash # Use Ghostscript non-standard extensions (for screen display only) antiword -p a4 -i 0 document.doc > output.ps ``` -------------------------------- ### Antiword CLI: Basic Text Conversion Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Convert Word documents to plain text using the antiword command-line tool. Use standard input for piping data and control output width. ```bash # Basic usage: Convert Word document to text antiword document.doc ``` ```bash # Read and convert from standard input cat document.doc | antiword - ``` ```bash # Set output line width to 80 characters antiword -w 80 document.doc ``` ```bash # Put entire paragraphs on one line (suitable for input to other text processors) antiword -w 0 document.doc ``` ```bash # Output formatted text (*bold*, /italic/, _underline_) antiword -f document.doc ``` -------------------------------- ### antiword Command-Line Tool: PostScript Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Converts Word documents to PostScript format, supporting various paper sizes and orientations. Useful for high-quality document output. ```APIDOC ## antiword Command-Line Tool - PostScript Output Mode ### Description Converts Word documents to PostScript format, supporting various paper sizes and orientations. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-p [PAPERSIZE]** (string) - Specifies the paper size for PostScript output. Supported values include: `10x14`, `a3`, `a4`, `a5`, `b4`, `b5`, `executive`, `folio`, `legal`, `letter`, `note`, `quarto`, `statement`, `tabloid`. - **-L** (flag) - Sets landscape orientation for PostScript output. - **-i [LEVEL]** (integer) - Controls image processing level in PostScript output. `1` for no images, `2` for Level 2 compatibility (default), `3` for Level 3 compatibility (experimental), `0` for non-standard Ghostscript extensions. ### Request Example ```bash # Convert to A4 PostScript antiword -p a4 document.doc > output.ps # Convert to Letter size PostScript antiword -p letter document.doc > output.ps # Use landscape orientation antiword -p a4 -L document.doc > output.ps # Do not display images in PostScript output antiword -p a4 -i 1 document.doc > output.ps ``` ### Response #### Success Response PostScript content of the Word document, redirected to a file. #### Response Example (Binary PostScript data written to `output.ps`) ``` -------------------------------- ### Antiword CLI: PostScript Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Convert Word documents to PostScript format with specified paper sizes and orientation. This is useful for high-quality document output or printing. ```bash # Convert to A4 paper size PostScript antiword -p a4 document.doc > output.ps ``` ```bash # Convert to Letter paper size antiword -p letter document.doc > output.ps ``` ```bash # Use landscape mode antiword -p a4 -L document.doc > output.ps ``` -------------------------------- ### Antiword CLI: PDF Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Directly generate Adobe PDF output from Word documents with specified paper sizes. This simplifies PDF creation workflows. ```bash # Convert to A4 paper size PDF antiword -a a4 document.doc > output.pdf ``` ```bash # Convert to Letter paper size PDF antiword -a letter document.doc > output.pdf ``` -------------------------------- ### Antiword CLI: Special Text Options Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Include hidden text or text marked as deleted by the revision system in the output. Useful for comprehensive document analysis. ```bash # Include hidden text antiword -s document.doc ``` ```bash # Include text deleted by the revision system antiword -r document.doc ``` ```bash # Include both hidden text and deleted text antiword -s -r document.doc ``` -------------------------------- ### antiword Command-Line Tool: PDF Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Directly generates Adobe PDF output from Word documents, with options for paper size. ```APIDOC ## antiword Command-Line Tool - PDF Output Mode ### Description Directly generates Adobe PDF output from Word documents, with options for paper size. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-a [PAPERSIZE]** (string) - Specifies the paper size for PDF output. Supported values are the same as for `-p` (e.g., `a4`, `letter`). ### Request Example ```bash # Convert to A4 PDF antiword -a a4 document.doc > output.pdf # Convert to Letter size PDF antiword -a letter document.doc > output.pdf ``` ### Response #### Success Response PDF content of the Word document, redirected to a file. #### Response Example (Binary PDF data written to `output.pdf`) ``` -------------------------------- ### antiword Command-Line Tool: Character Set Mapping Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Allows specifying character set mapping files for handling various international character sets, including UTF-8. ```APIDOC ## antiword Command-Line Tool - Character Set Mapping ### Description Specifies a character set mapping file to correctly interpret and output international characters. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-m [MAPPING_FILE]** (string) - Specifies the character set mapping file to use. Examples include `UTF-8.txt`, `8859-1.txt`, `8859-2.txt`, `8859-5.txt`, `koi8-r.txt`, `cp1252.txt`. ### Request Example ```bash # Use UTF-8 encoding (supports Chinese, Japanese, Korean) antiword -m UTF-8.txt document.doc # Use Western European character set antiword -m 8859-1.txt document.doc # Use Eastern European character set (Polish, Czech, etc.) antiword -m 8859-2.txt document.doc # Use Russian character set antiword -m 8859-5.txt document.doc antiword -m koi8-r.txt document.doc # Use Simplified Chinese Windows code page antiword -m cp1252.txt document.doc ``` ### Response #### Success Response Plain text content of the Word document, with characters correctly mapped. #### Response Example (Text output with correctly rendered international characters) ``` -------------------------------- ### antiword Command-Line Tool: Special Text Options Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Options to include hidden text or text marked as deleted by revision tracking. ```APIDOC ## antiword Command-Line Tool - Special Text Options ### Description Includes hidden text or text marked as deleted by revision tracking in the output. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-s** (flag) - Includes hidden text in the output. - **-r** (flag) - Includes text that has been deleted by the revision tracking system. ### Request Example ```bash # Include hidden text antiword -s document.doc # Include text marked as deleted by revision tracking antiword -r document.doc # Include both hidden text and deleted text antiword -s -r document.doc ``` ### Response #### Success Response Plain text content of the Word document, including specified special text. #### Response Example (Text output potentially containing hidden or deleted content) ``` -------------------------------- ### Transform Doc Stream to Text using Python Source: https://github.com/baituhuangyu/antiword-python/blob/master/README.md Read a binary .doc file and transform its content into a text string using the transform_doc_stream function. This method is useful for processing binary streams directly in Python. ```python import transform_doc YOUR_DOC = "./demo.doc" with open(YOUR_DOC, "rb") as fp: content = fp.read() txt = transform_doc.transform_doc_stream(content) print(txt) ``` -------------------------------- ### antiword Command-Line Tool: XML Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Outputs Word documents in XML format, specifically supporting DocBook document type definitions. ```APIDOC ## antiword Command-Line Tool - XML Output Mode ### Description Outputs Word documents in XML format, currently supporting DocBook document type definitions. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-x [FORMAT]** (string) - Specifies the XML output format. Currently, only `db` (DocBook) is supported. ### Request Example ```bash # Convert to DocBook XML format antiword -x db document.doc > output.xml ``` ### Response #### Success Response XML content of the Word document, redirected to a file. #### Response Example ```xml Document Title Chapter Title This is the content of the document... ``` ``` -------------------------------- ### Transform DOC Binary Stream to Text with Python Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Use this Python function to convert a binary stream of a Microsoft Word document into plain text. It's suitable for processing data from network streams, databases, or streaming systems. ```python import transform_doc # From file reading DOC binary stream YOUR_DOC = "./demo.doc" with open(YOUR_DOC, "rb") as fp: content = fp.read() # Convert binary stream to text txt = transform_doc.transform_doc_stream(content) print(txt) # Output example: # This is the content of the Word document... # Including paragraphs, lists, and other text elements. ``` -------------------------------- ### antiword Command-Line Tool: Text Output Source: https://context7.com/baituhuangyu/antiword-python/llms.txt The antiword command-line tool can convert Word documents to plain text. Options include controlling line width and reading from standard input. ```APIDOC ## antiword Command-Line Tool - Text Output Mode ### Description Outputs the content of a Word document in plain text format. Supports controlling line width and reading from standard input. ### Method `antiword [OPTIONS] [DOCUMENT]` ### Endpoint N/A (Command-line tool) ### Parameters #### Path Parameters None #### Query Parameters None #### Command-line Options - **-w [WIDTH]** (integer) - Optional - Sets the output line width. `0` means no line wrapping. - **-** (flag) - Reads document content from standard input. - **-f** (flag) - Outputs formatted text with markup for bold, italic, and underline. ### Request Example ```bash # Basic usage: Convert Word document to text antiword document.doc # Read from standard input and convert cat document.doc | antiword - # Set output line width to 80 characters antiword -w 80 document.doc # Output paragraphs on a single line antiword -w 0 document.doc # Output formatted text (*bold*, /italic/, _underline_) antiword -f document.doc ``` ### Response #### Success Response Plain text content of the Word document. #### Response Example ``` This is the content of the Word document... ``` ``` -------------------------------- ### Antiword CLI: Character Set Mapping Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Specify character set mapping files for handling various international character sets, including UTF-8, ISO-8859 series, and Windows code pages. ```bash # Use UTF-8 encoding (supports Chinese, Japanese, Korean) antiword -m UTF-8.txt document.doc ``` ```bash # Use Western European character set antiword -m 8859-1.txt document.doc ``` ```bash # Use Eastern European character set (Polish, Czech, etc.) antiword -m 8859-2.txt document.doc ``` ```bash # Use Russian character set antiword -m 8859-5.txt document.doc antiword -m koi8-r.txt document.doc ``` ```bash # Use Simplified Chinese Windows code page antiword -m cp1252.txt document.doc ``` -------------------------------- ### Python API: transform_doc_stream Source: https://context7.com/baituhuangyu/antiword-python/llms.txt Converts a Microsoft Word document's binary stream directly into a plain text string without creating temporary files. This is useful for processing binary streams from network or streaming systems. ```APIDOC ## transform_doc_stream ### Description Converts a DOC binary stream to text. ### Method `transform_doc_stream(binary_content: bytes) -> str` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **binary_content** (bytes) - Required - The binary content of the Microsoft Word document. ### Request Example ```python import transform_doc YOUR_DOC = "./demo.doc" with open(YOUR_DOC, "rb") as fp: content = fp.read() txt = transform_doc.transform_doc_stream(content) print(txt) ``` ### Response #### Success Response (200) - **txt** (str) - The extracted plain text content from the Word document. #### Response Example ``` This is the content of the Word document... Including paragraphs, lists, and other text elements. ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.