Problem/Motivation
This came up because trying to print pages in my local development environment was failing because Dompdf was not accepting my self-signed SSL certificate for background image URLs and such.
Steps to reproduce
You can see the SSL warnings by setting up the Dompdf global variables:
global $_dompdf_warnings;
$_dompdf_warnings = [];
global $_dompdf_show_warnings;
$_dompdf_show_warnings = true;
and then inspecting $_dompdf_warnings after the call to $dompdf->render() in print_pdf_dompdf_print_pdf_generate().
Proposed resolution
You can set a HTTP stream context to ignore SSL failures on the Dompdf object. If we add support for a hook_print_pdf_dompdf_alter() hook (similar to the other PDF library handlers), people can do this in their custom modules:
function localdev_print_pdf_dompdf_alter($dompdf) {
$dompdf->setHttpContext(stream_context_create(array('ssl'=>array('verify_peer'=>FALSE,'verify_peer_name'=>FALSE))));
}
Remaining tasks
I'll attach a patch to add this line.
User interface changes
None.
API changes
Create a new hook_print_pdf_dompdf_alter($dompdf) hook.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | print-dompdf_alter-3201297-1.patch | 716 bytes | brad.bulger |
Comments
Comment #2
brad.bulger commentedAs far as I can tell this only requires adding a drupal_alter() call to print_pdf_dompdf.pages.inc.
Comment #3
brad.bulger commentedComment #4
renatog commentedIt realy Makes sense
Comment #6
renatog commentedMoved to the dev branch
Thank you so much