<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: 1.2.1</li>
<li>Operating System: Mac</li>
<li>Node.js version: 12.14</li>
<li>Browser: Chromium</li>
</ul>
<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">When navigating to PDF that is delivered with the header <code class="notranslate">Content-Disposition: inline</code>, Playwright opens in a new page and uses the embedded Chromium PDF viewer.</p>
<p dir="auto">From this point it's impossible to get the actual PDF content. Even when inspecting the <code class="notranslate">response</code> event, the actual <code class="notranslate">response</code> object's body only contains the HTML presenting the embedded viewer with an inline ID representing the PDF.</p>
<p dir="auto">Whilst I'm sure there are some situations that would warrant the in-browser PDF viewer being turned on, I would guess that having these download by default would be the more common use-case within Playwright.</p>
<p dir="auto">Hi!</p>
<p dir="auto">On creation of a browser or context (permanent or otherwise), is it possible to set the config value <code class="notranslate">AlwaysOpenPdfExternally</code> or the equivalent <code class="notranslate">plugins.always_open_pdf_externally</code> preference?</p>
<p dir="auto">I've tried a kludgy solution that has me navigate to <code class="notranslate">chrome://settings/content/pdfDocuments</code> on load and click the option. But we need to use Chromium in headless to export PDFs of pages as well as download PDF files that the browser always opens in its embedded viewer… and there seems to be no way of getting the actual PDF content out of that viewer.</p>
<p dir="auto">Any help would be appreciated.</p>
<p dir="auto">Cheers, Wayne</p>