kkFileView Online Document Preview

repository·master·Indexed 12 days ago

https://github.com/kekingcn/kkfileview

A Spring Boot-based open-source solution for online document previewing. It provides a REST API to support a wide array of file formats, including Office documents (doc, docx, xls, xlsx, ppt, pptx), PDF, CAD models (dwg, dxf), 3D files (obj, stl, fbx), images, multimedia, and compressed archives. Version 5.0.1 requires JDK 21+ and includes critical security fixes for SSRF and path traversal.

Tokens
14.6K
Snippets
49
Records
88
Agent score
93%

What's inside kkFileView

  1. Overview of kkFileView

    master

    kkFileView is an open-source online document preview solution built with Spring Boot. It provides a RESTful API service that supports a wide range of file formats, making it easy to integrate into cross-language and cross-platform applications (Java, PHP, Python, Go, etc.).

    Key Features:

    • Extensive Format Support: Covers Office documents, WPS, OpenOffice, Visio, images, 3D models, CAD, text, compressed files, multimedia, and more.
    • Easy Deployment: Built on Spring Boot for simple setup.
    • Extensible Architecture: Abstracted preview interfaces allow for easy secondary development and adding new file type support.
    • Open Source: Licensed under the Apache protocol.
  2. Overview of kkFileView features and supported formats

    master

    kkFileView is an open-source document online preview solution built with Spring Boot. It provides a REST API and an abstract file preview interface that allows developers to extend support for additional file extensions.

    Key supported formats include:

    • Office Documents: doc, docx, xls, xlsx, ppt, pptx, csv, tsv, wps, dps, et, odt, ods, etc.
    • PDF & Text: pdf, ofd, rtf, txt, xml, md, and source code (java, php, py, js, css).
    • Images: jpg, png, gif, bmp, webp, svg, tif, tga, etc. (supports flip, zoom, and mirror).
    • 3D & CAD Models: obj, stl, fbx, dwg, dxf, ifc, etc.
    • Compressed Files: zip, rar, jar, tar, 7z, etc.
    • Multimedia: mp3, wav, mp4, avi, mov, mkv, etc.
    • Other: xmind, drawio, bpmn, epub, eml, msg, and dcm.
  3. Italian Writing Aids extension functionality

    master

    The Italian Writing Aids extension provides language support for Italian within LibreOffice. It includes the following features:

    • Spellchecker: Provides spell-checking capabilities. The module is compatible with any program that supports MySpell, ASpell, or HunSpell dictionary formats.
    • Thesaurus: Provides a dictionary of synonyms for the Italian language.
    • Hyphenation: Provides syllable/hyphenation patterns for Italian text.

    This extension is a fork of the 'Dizionario italiano' (v2.4) and 'Thesaurus italiano' (v2.07.gh) packages and uses hyphenation patterns derived from TeX patterns.

  4. What is DivSilab and how does it work?

    master

    DivSilab is a syllable divider tool for LibreOffice, developed by the Brazilian community. It is used for text hyphenation (translineation), allowing words to be split syllabically at the end of a line.

    Core Algorithm: Liang's Algorithm

    The tool is based on Frank M. Liang's algorithm, which uses a scoring system to determine syllable division points:

    • Values 1, 3, 5, 7, 9 (Odd): Indicate possible syllable division points. Higher numbers indicate a
    s2i3l4á3b2i3c4a2s   <--- Resultado
    s i-l á-b i-c a s --> si-lá-bi-cas
  5. Understand English Hunspell Dictionary variants

    master

    The English Hunspell dictionaries are derived from SCOWL and are categorized into two main types based on word coverage and spelling consistency:

    Normal Dictionaries (SCOWL size 60)

    • Characteristics: Designed for consistent spelling; generally includes only one spelling variant for a word.
    • Available Variants:
      • en_US (American)
      • en_CA (Canadian)
      • en_GB-ise (British with "ise" spelling)
      • en_GB-ize (British with "ize" spelling)
      • en_AU (Australian)

    Large Dictionaries (SCOWL size 70)

    • Characteristics: May include multiple spelling variants for a word when variants are considered nearly equal.
    • Caveats: These have not been as carefully checked for errors as normal dictionaries and may contain misspelled/invalid words or uncommon words that could be mistaken for misspellings (e.g., "ort", "calender").
    • Available Variants:
      • en_US-large
      • en_CA-large
      • en_GB-large (includes both "ise" and "ize")
      • en_AU-large
  6. License information for the Italian Thesaurus

    master

    The Italian Thesaurus is released under the terms and conditions of the GNU General Public License (GPL), version 3.

    Starting from version 2.0, the extension also includes a thesaurus from http://search.mnogo.ru (contributed by Marcello Bianchetti), which is provided under the public domain for integration purposes.

  7. Security and Access Control Configuration

    master

    kkFileView includes several security features to prevent abuse and unauthorized access:

    • Trust Host Filtering: You can configure a whitelist of trusted domains/IPs. The trust.host configuration supports wildcards and CIDR matching.
    • File Upload Limits: You can configure restrictions on high-risk file uploads (e.g., .exe).
    • Authentication: Supports Basic Authentication and AES Encryption for secure access.
    • Watermarking: Supports global watermarks and dynamic watermark content via parameters.
  8. How the package handles binary data in text messages

    master

    Because email is primarily text-based, the Model stores text data as Unicode strings. To handle malformed messages or non-ASCII characters that cannot be decoded, the package uses the surrogateescape error handler of the ASCII codec.

    This allows the package to "carry" un-decodable binary data through the Model during parsing and manipulation. The data is only converted back into its original byte form during the Finalization (Generator) stage. While this is largely an internal implementation detail, it ensures that data integrity is maintained even when encountering invalid character sets.

  9. Understand the Liang Algorithm scoring system

    master

    The DivSilab tool implements Liang's algorithm using integer values to weight syllable division possibilities. The scoring logic is as follows:

    DescriptionWeightLiang Input
    Better than below59
    Better than below47
    Better than below35
    Better than below23
    Admissible11
    Avoid00
    Worse than above-12
    Worse than above-24
    Worse than above-36
    Worse than above-48

    Key Rules:

    • Odd numbers (1, 3, 5, 7, 9): Represent potential division points. Higher values indicate a stronger preference for division.
    • Even numbers (0, 2, 4, 6, 8): Represent points that should not be divided. Higher values indicate a stronger preference against division.
    • The dot (.): Represents the word boundary. It is positioned to the left of the start of the word and to the right of the end of the word.
  10. How Policy controls header management

    master

    The Policy object manages how headers move through the message lifecycle via specific hooks. This allows developers to customize how headers are interpreted and serialized without changing the core Model.

    There are four main pathways for headers:

    PathwayMethodDescription
    Parsing (from raw data)header_source_parseCalled by the Parser to turn raw lines into (name, value) tuples.
    Storing (from application)header_store_parseCalled when an application sets a header (e.g., via __setitem__).
    Fetching (to application)header_fetch_parseCalled when an application retrieves a header value.
    Folding (to serialization)fold / binary_foldCalled by the Generator to format headers with appropriate line breaks.

    Additionally, cte_type determines if Content Transfer Encoding is performed on header data.

  11. Understand the `email` package architecture

    master

    The email package is organized around a central Model that represents an email message. It consists of four primary components:

    1. Model: An object structure (primarily the email.message.Message class) that provides an API for creating, querying, and modifying messages. It divides a message into a header section (accessed like a dictionary) and a payload (the body).
    2. Parser: Converts a sequence of characters or bytes into a Model object.
    3. Generator: Converts a Model object back into a sequence of characters or bytes (either Unicode for humans or encoded bytes for transmission).
    4. Policy: An object that controls the behavior of the library (e.g., how headers are parsed, folded, or how Content Transfer Encoding is applied). Policies allow the library to switch between different standards, such as RFC 5322 for standard email or RFC 2616 for HTTP headers.