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.

CommentFileSizeAuthor
#2 print-dompdf_alter-3201297-1.patch716 bytesbrad.bulger

Comments

brad.bulger created an issue. See original summary.

brad.bulger’s picture

StatusFileSize
new716 bytes

As far as I can tell this only requires adding a drupal_alter() call to print_pdf_dompdf.pages.inc.

brad.bulger’s picture

Issue summary: View changes
renatog’s picture

Status: Active » Reviewed & tested by the community

It realy Makes sense

  • RenatoG committed c001fc2 on 7.x-2.x authored by brad.bulger
    Issue #3201297 by brad.bulger, RenatoG: Add print_pdf_dompdf_alter hook...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moved to the dev branch

Thank you so much

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.