3

I am using MPDF to generate a pdf with images. With http:// all works fine, but after changing my whole site to https:// I only get red crosses where the images should appear.

If I watch the generated file as html version, the images are all there, with https://, but in the generated PDF they are just not shown.

Any hint?

UPDATE: Error was because of CURL ("SSL certificate problem: unable to get local issuer certificate")

It was resolved by adding curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); to mpdf.php

Answer was found here: curl: (60) SSL certificate : unable to get local issuer certificate

Dirty Way: cURL PHP RESTful service always returning FALSE

fourgood
  • 187
  • 1
  • 15

3 Answers3

12

For anyone coming here from Google - there is now a better solution. mPDF now supports setting curlAllowUnsafeSslRequests.

$mdf = new Mpdf(<your configuration>);
$mpdf->curlAllowUnsafeSslRequests = true;

This will set the CURL parameters properly for you without having to modify mPDF. Obviously, use only in appropriate situations, as this disables SSL all verification protections.

Scott 'scm6079'
  • 1,517
  • 13
  • 25
0

To resolve this issue you need to remove the protocol from URL for this I have created a plugin please install it and activate.

Here is the plugin link:- https://wordpress.org/plugins/vg-protocol-removed-not-secure-connection/

Vishal Gupta
  • 903
  • 9
  • 26
  • thanks for your answer - but sadly this does not resolve the problem. I am already using the "Really Simple SSL" addon, to keep all URLs https://. In webview the images are shown correctly (with https:// in front), but in PDF view, they are not visible (only red crosses) – fourgood Jun 29 '17 at 19:20
  • Can you attached the screenshot – Vishal Gupta Jun 30 '17 at 03:56
  • You need to regenerate the pdf Thumbnails for regenerate the PDF thumbnails please visit the link: http://www.wpbeginner.com/plugins/how-to-regenerate-pdf-thumbnails-in-wordpress/ – Vishal Gupta Jun 30 '17 at 11:13
  • How should this be connected to the issue? – fourgood Jun 30 '17 at 11:54
  • you site PDF thumbnails is missing, so you need to regenerate the thumbnails. – Vishal Gupta Jun 30 '17 at 12:54
  • Please see updated question on how it was finally solved – fourgood Jun 30 '17 at 14:07
0

If you have a root cert, it's preferable to provide it using CURLOPT_CAINFO or CURLOPT_CAPATH than to bypass validation altogether.

It is a shame mPDF isn't designed better so you could avoid modifying the library code directly.

Matt
  • 61
  • 8