Hi,
Please try to find out who is calling window.print in your code and see if you can replace it with WebView.Print. We verified that both blob Url and printing blob Url works correctly with the latest build (build 26.1.34). We use the following test file:
test.html
Code: HTML/ASPX
<div id="div1">
Please Wait...
</div>
<a id="link1" href="#" target="test" style="display:none;">Click To Open PDF in a new tab</a>
<script>
(async () =>
{
//Create a blob url from an online PDF file
var url = "https://s29.q4cdn.com/175625835/files/doc_downloads/test.pdf";
const response = await fetch(url);
const blob = await response.blob();
//Update link1's href to the blob Url
url = URL.createObjectURL(blob);
var div = document.getElementById("div1");
div.style.display = "none";
var link = document.getElementById("link1");
link.href = url;
link.style.display = "";
})();
</script>
We then follow these steps:
1. Use TabbedBrowser sample application to load test.html;
2. Click "Click To Open PDF in a new tab" link when it appears;
3. This opens a new tab with the PDF file. Notice it has a blob Url in the address bar;
4. Print the PDF file by clicking the print button in the PDF viewer;
5. Print the PDF file by pressing Ctrl + P shortcut;
Both cases the PDF file prints out fine. This means printing blob Url for PDF file is working correctly.
The difference between your code and this test case appears to be how the printing is triggered. In this test case:
Step 4: The printing is triggered by direct user action;
Step 5: The printing is triggered by calling WebView.Print method (TabbedBrowser sample application handles Ctrl + P shortcut and calls WebView.Print);
In your code, it appears that JavaScript from another origin is calling window.print method that violates CORS rule. This violation is a security feature by design so you are not supposed to be able to get around it through JavaScript. However if you call WebView.Print directly through your code then such check will be bypassed because WebView.Print originates from the embedder (your code), not JavaScript from another origin. So if you replace your printing code with WebView.Print you should not run into this issue.
Hope this helps. Please feel free to let us know if you still have any questions.
Thanks!