Make print labels send file as download.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 17 May 2019 12:48:53 +0000 (08:48 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 17 May 2019 12:48:53 +0000 (08:48 -0400)
Forcing download file for the uptra print labels. This might solve the
issue with the print labels not printing correctly.

lib/GlmPDFLabel.php

index 884edef..b50ae79 100644 (file)
@@ -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();
 
     }