Hi.
I have a question about css style and images on DomPdf, in localhost everything works, but whe I publish my site and access it remotly the genereated Pdf’s not load css or images.
How can solve it?
Thanks.
Do you have any sample code ? I tried a few PDF generates before, including DomPdf. Based on my experience, fpdf does the best job in terms of code->visual. Other code->visual doesn’t seem correct.
Hi of course.
In localhost it works, but accesing the domain name does not.
Controller:
public function certificadoafiliaciones($id = null)
{
$this->infopdfs($id);
$this->viewBuilder()->enableAutoLayout(false);
$contrato = $this->Contratos->get($id);
$this->viewBuilder()->setClassName('CakePdf.pdf');
$this->viewBuilder()->setOption(
'pdfConfig',
[
'orientation' => 'portrait',
'download' => true,
'filename' => 'Certificado_Afiliaciones_Contrato_Id_' . $id . '.pdf'
]
);
}
View:
<?= $this->Html->image($empresaLogo, ['fullBase' => true]); ?> <?= $this->Html->css('pdf.css', ['fullBase' => true]) ?>check the relative address of the css file on the server.if the it’s works on local then defiantly Path problem for css or. check the template/layout/pdf file paths.
Hi.
I don’t have any template/layout/pdf
Thanks.
Hi.
I find somethig with http it is fine inside and outside server, but with https css and images do not load on pdf…
Thanks