<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://www.github.com/electron/electron/issues">issue tracker</a> for a feature request that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Electron Version</h3>
<p dir="auto">13.1.17</p>
<h3 dir="auto">What operating system are you using?</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Operating System Version</h3>
<p dir="auto">win10 20H2</p>
<h3 dir="auto">What arch are you using?</h3>
<p dir="auto">x64</p>
<h3 dir="auto">Last Known Working Electron version</h3>
<p dir="auto">9.0.0</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">const options = {</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        deviceName: &quot;233B&quot;,
        silent: true,
        printBackground: true,
        margins: {
          marginsType: 'custom',
          top: 0,
          bottom: 0,
          left: 0,
          right: 0
        },
        pageSize: {
          width: curTagBaseSet.printSet.width * 1000 - 1000,
          height: curTagBaseSet.printSet.height * 1000,
        }
      }"><pre class="notranslate"><code class="notranslate">        deviceName: "233B",
        silent: true,
        printBackground: true,
        margins: {
          marginsType: 'custom',
          top: 0,
          bottom: 0,
          left: 0,
          right: 0
        },
        pageSize: {
          width: curTagBaseSet.printSet.width * 1000 - 1000,
          height: curTagBaseSet.printSet.height * 1000,
        }
      }
</code></pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">webview print is not working with deviceName</p>
<h3 dir="auto">Testcase Gist URL</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://www.github.com/electron/electron/issues">issue tracker</a> for a feature request that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Electron Version</h3>
<p dir="auto">12.0.5,11.3.0,12.0.7</p>
<h3 dir="auto">What operating system are you using?</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Operating System Version</h3>
<p dir="auto">Windows 10</p>
<h3 dir="auto">What arch are you using?</h3>
<p dir="auto">x64</p>
<h3 dir="auto">Last Known Working Electron version</h3>
<p dir="auto">12.0.7</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Window Set printer dynamically</p>
<p dir="auto">code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="let printCon = { silent: true, printBackground: false, ...printOptions }
log.log('url = ' + strUrl + '\n printCon=' + JSON.stringify(printCon))

try {
  // did-finish-load
  printWindow.webContents.on('did-finish-load', () =&gt; {
    log.log('did-finish-load')
    printWindow.webContents.print(
        printCon,
      (success, failureReason) =&gt; {
        log.log('success=' + success + ' failureReason =' + failureReason)
        if (callback) {
          callback(success ? null : failureReason)
        }
      }
    )
  })"><pre class="notranslate"><code class="notranslate">let printCon = { silent: true, printBackground: false, ...printOptions }
log.log('url = ' + strUrl + '\n printCon=' + JSON.stringify(printCon))

try {
  // did-finish-load
  printWindow.webContents.on('did-finish-load', () =&gt; {
    log.log('did-finish-load')
    printWindow.webContents.print(
        printCon,
      (success, failureReason) =&gt; {
        log.log('success=' + success + ' failureReason =' + failureReason)
        if (callback) {
          callback(success ? null : failureReason)
        }
      }
    )
  })
</code></pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Windows Error: webContents.print(): Invalid deviceName provided!<br>
mac is working</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1973318/118950086-725a1b80-b98c-11eb-8764-e13b7a41b018.png"><img src="https://user-images.githubusercontent.com/1973318/118950086-725a1b80-b98c-11eb-8764-e13b7a41b018.png" alt="截屏2021-05-20 下午4 22 17" style="max-width: 100%;"></a></p>
<h3 dir="auto">Testcase Gist URL</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional Information</h3>
<p dir="auto">code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="let printCon = { silent: true, printBackground: false, ...printOptions }
log.log('url = ' + strUrl + '\n printCon=' + JSON.stringify(printCon))

try {
  // did-finish-load
  printWindow.webContents.on('did-finish-load', () =&gt; {
    log.log('did-finish-load')
    printWindow.webContents.print(
        printCon,
      (success, failureReason) =&gt; {
        log.log('success=' + success + ' failureReason =' + failureReason)
        if (callback) {
          callback(success ? null : failureReason)
        }
      }
    )
  })"><pre class="notranslate"><code class="notranslate">let printCon = { silent: true, printBackground: false, ...printOptions }
log.log('url = ' + strUrl + '\n printCon=' + JSON.stringify(printCon))

try {
  // did-finish-load
  printWindow.webContents.on('did-finish-load', () =&gt; {
    log.log('did-finish-load')
    printWindow.webContents.print(
        printCon,
      (success, failureReason) =&gt; {
        log.log('success=' + success + ' failureReason =' + failureReason)
        if (callback) {
          callback(success ? null : failureReason)
        }
      }
    )
  })
</code></pre></div>