0
function contasApagar() {
$fornecedorDAO = new fornecedoresDAO();
$retfornecedor = $fornecedorDAO->buscarTodos();
$forma_pagtoDAO = new forma_pagtoDAO();
$retformapagamento = $forma_pagtoDAO->buscarTodas();
$contaDAO = new contas_pagarDAO();
$retorno = $contaDAO->filtrarData();
// include autoloader
require_once "vendor/autoload.php";
//referenciando o namespace
use Dompdf \ Dompdf ;
// instanciando o dompdf
$dompdf = new Dompdf();
//lendo o arquivo HTML correspondente
$html = file_get_contents('visao/relatorios/contasApagar_pdf.php');
//require_once "visao/relatorios/contasApagar_pdf.php";
//inserindo o HTML que queremos converter
$dompdf->loadHtml($html);
//Definindo o tipo de fonte padrão
$dompdf->set_option('defaultFont', 'Times New Roman');
// Definindo o papel e a orientação
$dompdf->setPaper('A4', 'portrait');
// Renderizando o HTML como PDF
$dompdf->render();
// Enviando o PDF para o browser
$dompdf->stream();
}
I think you have something related here: https://answall.com/q/51014/8063
– Sam
I may be wrong, but namespace and use statements is usually at the beginning of the file
– Wallace Maxters
If I were to guess, I would say that use should be done this way:
function contasApagar() use (Dompdf\Dompdf) { /* ... */ }
, but it’s just an idea. But why not declare the use of the class at the beginning of the file?– Costamilam
use and namespace is at the top of the file.
– novic
Solved use namespace is at the top of the file.
– Gustavo Ribeiro