Roots Discourse

Installing DOMPDF library

Hi, I’m trying to install this library to convert HTML to PDF :

Just running composer command the library was installed into vendor directory but in the requirements page are some other things to install:

PDFlib
php-font-lib 0.4.x
php-svg-lib 0.1.x

What is the correct way to install it? Should I run usual apt-get commands?

Thank you!

If you’re using Trellis then the PHP extensions required should be enabled by default.

The other requirements you link to are in the composer.json file for dompdf, so they should be installed automatically by composer.

Have you tried using the library?

1 Like

Not yet! then, maybe it works. I’ll go to try it.

And, yes PHP extension are enabled. I can see it at info.php file.

I had to run composer again inside vendor/dompdf/ and third party libraries were installed in vendor/dompdf/vendor directoy. Installation was succesfull.

Thank you very much for the help.

That shouldn’t be necessary, since Composer should also get all requirements from a package you are installing…

I did it again to check that, with same results. My steps:

  1. I did run composer require dompdf/dompdf:0.7.x@beta from bedrock project folder
  2. dompdf was added to composer.json and this folder structure was created inside vendor folder:
    -dompdf
    –dompdf
    —composer.json
    —some other stuff…
    (without third party libraries)
  3. I did run composer update from vendor/dompdf/dompdf and another vendor folder was created inside with third party libraries: vendor/dompdf/dompdf/vendor/third-party-libraries

What a mess! Anyway I will try the library as is. I had no time to do it by the moment.