Jump to content
Carlos Rocha

instalar GD PHP 7.2.1

Recommended Posts

Carlos Rocha

Estou tentando usar a biblioteca mPDF mas estou tendo um problema com dependências.

Sou novo com composer e estou apanhando um pouco por isso peço ajuda.

Tenho a bibliteca instalada à partir da raiz no seguinte endereço:

   

/_classes/_util/_mPDF/

Meu arquvo composer.json está assim:

    {
    
        "authors": [
            {
                "name": "Carlos Alberto",
                "email": "carcleo@gmail.com"
            }
        ],
        
        "require": {
        
            "mpdf/mpdf": "^7.2.1"
            
        }
        
    }

Quano rodo no CMD (sim, uso Windows 10) o comando abaixo:

php composer.phar install

Obtenho o seguinte mensagem de erro:

php composer.phar install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - mpdf/mpdf v7.1.9 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.8 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.7 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.6 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.5 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.4 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.1.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.0.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.0.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf v7.0.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - mpdf/mpdf 7.0.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for mpdf/mpdf ^7 -> satisfiable by mpdf/mpdf[7.0.2, v7.0.0, v7.0.1, v7.0.3, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.1.4, v7.1.5, v7.1.6, v7.1.7, v7.1.8, v7.1.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\Program Files\Apache24\php7\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Porém, ambas bibliotecas estão descomentadas no meu php.ini: 

extension=gd2
extension=php_gd2.dll

E sim, existe na pasta ext do PHP essas dll's.

Dúvidas

1) O que é preciso fazer para corrigir esse erro
2) Como configurar o endereçamento da biblioteca no require do json levando em conta o path informado no inicio dessa dúvida?

Share this post


Link to post
Share on other sites
Carlos Rocha

Bom, o problema era que meu editor não estava salvando as modificações no php.ini embora indicasse que estava. 

Percebi isso e agora está ok.

Bom, agora outro problema. 

Tenho 2 arquivos css para carregar no mPDF mas parece que não está carregando um deles.

	require 'vendor/autoload.php';

	$estiloSite = file_get_contents('http://localhost/wesleyanagceu.com.br/_scripts/_css/estilo.css');
	$estiloAdmin = file_get_contents('http://localhost/wesleyanagceu.com.br/_scripts/_css/admin.css');

	$html = $_POST["htmlPDF"];

	$mpdf = new \Mpdf\Mpdf();
	$mpdf->SetDisplayMode('fullpage');
	$mpdf->WriteHTML($estiloSite, \Mpdf\HTMLParserMode::HEADER_CSS);
	$mpdf->WriteHTML($estiloAdmin, \Mpdf\HTMLParserMode::HEADER_CSS);
	$mpdf->WriteHTML($html);
	$mpdf->Output("relatorio.pdf","D");


    
O que está errado?

Só dá para carregar apenas 1 css?

O HTML que vai popular o gráfico é do tipo:

 $html = "    
<ul class='border'>
   <li style='text-align: left; border-bottom: .1px rgb(0,0,0) solid;'><label class='labelPequeno'>Gcéu</label> : " . $celula['nomeCelula'] . "</li>
   <li style='text-align: left; border-bottom: .1px rgb(0,0,0) solid;' class='backCinza'><label class='labelPequeno'>Supervisor de Setor</label> : " . $nomeLideres['nomeLiderSetor'] . "</li>
   <li style='text-align: left; border-bottom: .1px rgb(0,0,0) solid;'><label class='labelPequeno'>Líder</label> : " . $celula['nomeLider'] . "</li>
   <li style='text-align: left;'><label class='labelPequeno'>Auxiliar</label> : " . $celula['nomeAuxiliar'] . "</li>
</ul>
<ul class='border'>
   <li style='text-align: left; border-bottom: .1px rgb(0,0,0) solid;'><label class='labelPequeno'>Dias que acontece</label> : " . $celula['diaReunioes'] . "</li>
   <li style='text-align: left;'><label class='labelPequeno'>Membros Ativos</label> : " . $membros . "</li>
</ul>";

 

Edited by carcleo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.