public function setDownloadHeaders($attachmentName, $mimeType = null, $inline = false, $contentLength = null)
    {
        $disposition = $inline ? 'inline' : 'attachment';

        $headers = [
            'Pragma' => 'public',
            'Accept-Ranges' => 'bytes',
            'Expires' => '0',
            'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
            'Content-Disposition' => $this->getDispositionHeaderValue($disposition, $attachmentName),
        ];

        if ($mimeType !== null) {
            $headers['Content-Type'] = $mimeType;
        }

        if ($contentLength !== null) {
            $headers['Content-Length'] = $contentLength;
        }

        foreach ($headers as $name => $value) {
            if (!$this->hasHeader($name)) {
                $this->setHeader($name, $value);
            }
        }

        return $this;
    }