From: Steve Sutton Date: Fri, 17 May 2019 12:48:53 +0000 (-0400) Subject: Make print labels send file as download. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=29bf216dcf91f67fe9dd1922db851acadc4e03cb;p=WP-Plugins%2Fglm-member-db-billing.git Make print labels send file as download. Forcing download file for the uptra print labels. This might solve the issue with the print labels not printing correctly. --- diff --git a/lib/GlmPDFLabel.php b/lib/GlmPDFLabel.php index 884edef..b50ae79 100644 --- a/lib/GlmPDFLabel.php +++ b/lib/GlmPDFLabel.php @@ -132,9 +132,21 @@ class GlmPDFLabel extends Cezpdf $this->ezNewPage(); } } - + $out = $this->ezOutput( true ); + $len = strlen( $out ); + header("Content-type: application/force-download\n"); + header("Content-type: application/pdf"); + header("Content-Length: $len"); + /* Correction for the stupid MSIE thing */ + $pdfName = 'MemberLabel' . date('U') . '.pdf'; + if (strstr(getenv('HTTP_USER_AGENT'), 'MSIE')) { + header("Content-Disposition: inline; filename=\"$pdfName\""); + } else { + header("Content-Disposition: attachment; filename=\"$pdfName\""); + } // Output PDF - $this->ezStream(); + print $out; + // $this->ezStream(); }