{"record":{"id":"3106b388177ec338","repo":"infiniflow/ragflow","slug":"no-pdf-engine-found-install-xelatex","errorCode":null,"errorMessage":"No PDF engine found. Install xelatex.","messagePattern":"No PDF engine found\\. Install xelatex\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"agent/component/docs_generator.py","lineNumber":281,"sourceCode":"        include_timestamp_in_body: bool = True,\n    ) -> tuple[str, bytes]:\n        import pypandoc\n\n        markdown_content = self._build_markdown_source(\n            content,\n            include_timestamp_in_body=include_timestamp_in_body,\n        )\n        converted_content = pypandoc.convert_text(\n            markdown_content,\n            to=target_format,\n            format=\"markdown\",\n        )\n        return self._write_bytes_output(converted_content.encode(\"utf-8\"), extension)\n\n    def _select_pdf_engine(self) -> str:\n        if shutil.which(\"xelatex\"):\n            return \"xelatex\"\n        raise Exception(\"No PDF engine found. Install xelatex.\")\n\n    def _get_pdf_font_args(self) -> list[str]:\n        return [\n            \"-V\",\n            f\"mainfont={self._pdf_main_font}\",\n            \"-V\",\n            f\"CJKmainfont={self._pdf_cjk_font}\",\n        ]\n\n    def _get_pdf_overlay_font_name(self) -> str:\n        from reportlab.pdfbase import pdfmetrics\n        from reportlab.pdfbase.cidfonts import UnicodeCIDFont\n\n        try:\n            pdfmetrics.getFont(self._pdf_overlay_font)\n        except KeyError:\n            pdfmetrics.registerFont(UnicodeCIDFont(self._pdf_overlay_font))\n","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/docs_generator.py#L263-L299","documentation":"Raised by DocGenerator._select_pdf_engine (agent/component/docs_generator.py): the component requires xelatex to produce PDF output (needed for CJK font support via -V mainfont/CJKmainfont args), and shutil.which('xelatex') found no xelatex binary on PATH. This is an environment dependency error, not a configuration error.","triggerScenarios":"Running an agent canvas with a DocGenerator component whose output_format is 'pdf' on a host or container where TeX Live (xelatex) is not installed or not on PATH. The check is unconditional: only xelatex is accepted, then Exception('No PDF engine found. Install xelatex.').","commonSituations":"Slim Docker images without TeX Live; local venv installs of RAGFlow without system packages; CI runners lacking texlive; PATH not including /usr/local/texlive/*/bin/* after a manual TeX install.","solutions":["Install TeX Live with xelatex: on Debian/Ubuntu 'apt-get install -y texlive-xetex' (plus texlive-fonts-recommended for Noto/STSong fonts)","In Docker, add the same packages to the image and rebuild so xelatex is on PATH","Verify with 'which xelatex' / 'xelatex --version' in the exact environment the backend worker runs in","As a workaround, switch output_format to 'docx', 'html', 'txt', or 'markdown', which do not need a TeX engine"],"exampleFix":"# before: Dockerfile without TeX\nFROM ragflow-base\n\n# after\nRUN apt-get update && apt-get install -y --no-install-recommends texlive-xetex texlive-fonts-recommended","handlingStrategy":"fallback","validationCode":"import shutil\n\ndef pdf_engine_available() -> bool:\n    return shutil.which('xelatex') is not None\n\nif not pdf_engine_available():\n    raise EnvironmentError('PDF output requires xelatex; install texlive-xetex or choose another output_format')","typeGuard":null,"tryCatchPattern":"try:\n    path, data = generator._generate_pdf(content)\nexcept Exception as e:\n    if 'No PDF engine found' in str(e):\n        path, data = generator._generate_docx(content)  # degrade gracefully, notify user\n    else:\n        raise","preventionTips":["Install texlive-xetex (and CJK fonts) in images that will run DocGenerator with pdf output","Add a startup capability check for xelatex and disable/annotate the pdf option when absent","Prefer docx/html output in environments where a TeX toolchain is impractical"],"tags":["environment","doc-generator","pdf","xelatex","pandoc"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}