{"record":{"id":"74903dc2f191865b","repo":"PHPOffice/PHPWord","slug":"unable-to-load-pdf-rendering-library","errorCode":null,"errorMessage":"Unable to load PDF Rendering library","messagePattern":"Unable to load PDF Rendering library","errorType":"exception","errorClass":"PhpOffice\\PhpWord\\Exception\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpWord/Writer/PDF/AbstractRenderer.php","lineNumber":94,"sourceCode":"\n    /**\n     * Create new instance.\n     *\n     * @param PhpWord $phpWord PhpWord object\n     */\n    public function __construct(PhpWord $phpWord)\n    {\n        parent::__construct($phpWord);\n        $this->isPdf = true;\n        if ($this->includeFile != null) {\n            $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;\n            if (file_exists($includeFile)) {\n                /** @noinspection PhpIncludeInspection Dynamic includes */\n                require_once $includeFile;\n            } else {\n                // @codeCoverageIgnoreStart\n                // Can't find any test case. Uncomment when found.\n                throw new Exception('Unable to load PDF Rendering library');\n                // @codeCoverageIgnoreEnd\n            }\n        }\n\n        // Configuration\n        $options = Settings::getPdfRendererOptions();\n        if (!empty($options['font'])) {\n            $this->setFont($options['font']);\n        }\n    }\n\n    /**\n     * Get Font.\n     *\n     * @return string\n     */\n    public function getFont()\n    {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/PHPOffice/PHPWord/blob/aef95c04151b5633cc505f672ddd6a71da900ee1/src/PhpWord/Writer/PDF/AbstractRenderer.php#L76-L112","documentation":"Constructor guard: the PDF renderer's include file (e.g. dompdf/tcpdf library entry) was not found under Settings::getPdfRendererPath(), so no PDF rendering library is available and the writer cannot be instantiated. Fires when the PDF library is not installed or pdfRendererPath is misconfigured.","triggerScenarios":"Thrown at src/PhpWord/Writer/PDF/AbstractRenderer.php:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the PDF rendering library (dompdf, tcpdf, or mPDF) via Composer and make its main file present under the configured library path.","Set Settings::setPdfRendererPath() to the directory containing the library's include file."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aef95c04151b5633cc505f672ddd6a71da900ee1","analyzedAt":"2026-09-14T10:53:58.933Z","contentChangedAt":"2026-09-14T10:53:58.933Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}