diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
index eb374283788e2127e7e5c14f3e3341e121dfba7a..628ff846d6a6f8c140ab79e8950132df9fea5f30 100644
--- a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
+++ b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
@@ -35,6 +35,8 @@ class FillPdfDownloadAction extends FillPdfActionPluginBase {
       $this->configuration['filename']
     );
     $response->headers->set('Content-Disposition', $disposition);
+    $response->headers->set('Content-Type', 'application/pdf');
+    $response->headers->set('Content-Length', strlen($this->configuration['data']));
 
     return $response;
   }
diff --git a/tests/src/Functional/HandlePdfControllerTest.php b/tests/src/Functional/HandlePdfControllerTest.php
index ea8431a5f52446855e0a70ac0e7329289a137c79..c8ad8720b2384cdf3cb69384d65f1224eadead0e 100644
--- a/tests/src/Functional/HandlePdfControllerTest.php
+++ b/tests/src/Functional/HandlePdfControllerTest.php
@@ -4,6 +4,7 @@ namespace Drupal\Tests\fillpdf\Functional;
 
 use Drupal\Core\Url;
 use Drupal\file\Entity\File;
+use Symfony\Component\HttpFoundation\ResponseHeaderBag;
 
 /**
  * @coversDefaultClass \Drupal\fillpdf\Controller\HandlePdfController
@@ -35,6 +36,8 @@ class HandlePdfControllerTest extends FillPdfUploadTestBase {
 
   /**
    * Tests DownloadAction.
+   *
+   * @throws \Behat\Mink\Exception\ExpectationException
    */
   public function testDownloadAction() {
     $this->uploadTestPdf('fillpdf_test_v3.pdf');
@@ -58,6 +61,10 @@ class HandlePdfControllerTest extends FillPdfUploadTestBase {
     $maybe_pdf = $this->getSession()->getPage()->getContent();
     static::assertEquals('application/pdf', $this->getMimeType($maybe_pdf), 'The file has the correct MIME type.');
 
+    // Ensure the headers are set to make the PDF download.
+    $this->assertSession()->responseHeaderContains('Content-Disposition', ResponseHeaderBag::DISPOSITION_ATTACHMENT);
+    $this->assertSession()->responseHeaderContains('Content-Type', 'application/pdf');
+    $this->assertSession()->responseHeaderContains('Content-Length', (string) strlen(file_get_contents($this->getTestPdfPath('fillpdf_test_v3.pdf'))));
   }
 
   /**