PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 14, 2022

[FIXED] Dompdf 0.8.3 not fetching remote CSS in PHP 7.2 and CodeIgniter 3

 March 14, 2022     codeigniter, dompdf, php     No comments   

Issue

I'm upgrading my environment to PHP7.3 (from PHP5.5) and my DomPDF new installation (from 0.6 to 0.8.3) does not fetch any external CSS files. All server-related configuration seems ok, but only relative CSS files are loaded.

What may I be missing?

I'm using the following lines to generate the PDF:

require_once("dompdf_0-8-3/autoload.inc.php");

$options = new Dompdf\Options();
$options->set(array('isPhpEnabled'          => true, 
                    'isRemoteEnabled'       => true, 
                    'isJavascriptEnabled'   => false, 
                    'isHtml5ParserEnabled'  => true, 
                    'tempDir'               => sys_get_temp_dir())
        );

$dompdf = new Dompdf\Dompdf();
$dompdf->setOptions($options);    
$dompdf->loadHtml($html);    
$dompdf->setPaper($size, $orientation);            
$dompdf->render();
$dompdf->stream($filename.".pdf");

Note: I'm using base_url() in link href's tag, inside the HTML view.

Anyone has the same problem or any suggestion on how to solve?


Solution

The problem was due to a port redirection issue in the server. Solved :) Thank you all!



Answered By - Pedro Conrad Junior
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing