dompdf / dompdf/dompdf

Setting new local files directory

Open
#2,421 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
PHP
Stars
11.2k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

I have 2 questions below.

1. Moving font dir

I moved font files from lib/fonts/. How do I tell Dompdf where to look for them (locally, without http protocol) ?

I tried that:

    $dompdf = new Dompdf(array(
        'enable_remote'         => true,
        'chroot'                => __DIR__,
        'fontDir'               => dirname(getcwd()) . 'resources/Dompdf/fonts/',
        'fontCache'             => dirname(getcwd()) . 'resources/Dompdf/fonts/',
        'isHtml5ParserEnabled'  => true
    ));

    $dompdf->options->setChroot(__DIR__);

But still looks for them in lib/fonts/:
require(Dompdf/dompdf/dompdf/lib/fonts/dompdf_font_family_cache.dist.php): failed to open stream: No such file or directory

2. Getting CSS file locally

How do I tell Dompdf where to get a certain css file (locally) instead of loading it with http protocol?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dompdf constructor options and the options->setChroot(DIR) call shown in the issue, then inspect the lib/fonts/ path and the local CSS-loading setup. Confirm how fontDir, fontCache, chroot, and local stylesheets are configured; done when the documented configuration lets users load both without HTTP.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.