2016-11-16 54 views
1

我使用DOMPDF创建了一个pdf,它在本地和服务器上使用HTTP工作正常,但是当源位于服务器中时,HTTPS不显示图像。图像不与DOMPDF一起用HTTPS显示

$options->set('isRemoteEnabled', TRUE); 
$dompdf = new Dompdf($options); 

$context = stream_context_create([ 
    'ssl' => [ 
     'verify_peer' => FALSE, 
     'verify_peer_name' => FALSE, 
     'allow_self_signed'=> TRUE 
    ] 
]); 
$dompdf->setHttpContext($context); 
+1

也许(?????)http://stackoverflow.com/a/22911050/797620 – Abela

+0

可能不是DOMpdf问题。尝试使用相同的流上下文读取远程Web $ fp = fopen($ yourUrl,'r',false,$ context);或$ response = file_get_contents($ yourUrl,0,$ context); – Curlas

+0

不,我很抱歉,dom pdf不接受http格式的网址。 – Curlas

回答

1

为了解决这个问题,我使用了路径“var/www/mysite/public/images/image.jpg”。我无法解决背景图像的问题,所以我使用绝对位置而不是背景图像与CSS的图像。