Greetings.
I am writing this post to report a small bug that is happening in the beta version of this module.
Every time I generate a pdf and perform a reload on the page appears the following warning.

Warning: Can not modify header information - headers already sent in drupal_send_headers () (line 1225 in / var / www / drupal / includes / bootstrap.inc).

This problem happens with the following scenario.
- Was installed print correctly.
- The library was installed wkhtmltopdf-amd64

The entire installation process took place normally.
The pdf is also usually generated. What happens is that it always appears Warning annoying that every time a pdf is generated.

In order to help them was behind the problem. What I found was this.
In the file print_pdf.pages.inc lines: 407, 408, 412. Runs a command to change the header of the page. Because of this Drupal generates this warning.

The big problem is that we can not run from these headers () because without them there is to generate the pdf file. Then I found a way to avoid this warning was present run this command immediately after you generate the PDF.

Enter the command flush () and return true, put it, unset ($ _SESSION);
So I force myself to avoid cleaning session and appear on the next reload the warning.
I ran a test with the function drupal_get_message ('error', true), but success in getting that call that should not be done in the same location. The only way I could do was not displayed using the unset ($ _SESSION).

I am also sending a screenshot of the problem.
Screenshot
Sorry for my english but I'm using Google translate hehehe.

If you need help I'm a Drupal developer six years and I can help fix future bugs that module.

Thank you for creating this module. Saved me a long time :-)

If you need help, call me.

[] 's

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benys’s picture

FileSize
408 bytes

function print_pdf_controller() should close drupal request (drupal_exit).

benys’s picture

Assigned: Ferrari » Unassigned
Status: Active » Needs review
medden’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm this patch fixed the reported error.
I was getting the same issue using wkhtmltopdf-11.0-i386 and the print-7.x.dev and 7.x.beta releases.

hanoii’s picture

+1, it fixed it on dompdf as well!

Jaapx’s picture

Thanks, #1 worked for me with wkhtmltopdf

bancarddata’s picture

Worked for me using TCPDF

jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Thanks benys. I've committed this to git.

Status: Fixed » Closed (fixed)

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