Trying to print PDF file retrieved from server.
Approach 1
- Retrieve PDF from server via AJAX
- Create Blob (
URL.createObjectURL(pdfFile)
) - Set blob ObjectUrl as a source to
iframe
- Print iframe (
iframeContentWindow.document.execCommand('print', false, null)
)
Problem
Not working in Edge since it has issue link1, link2, link3
Approach 2
- Set URL from which server returns PDF as a source to
iframe
- Print iframe
Problem
Endpoint which returns PDF requires authorization, as i see there is no way to pass authorization information, so iframe fails to load with 401 Unauthorized
.
How can i print PDF file retrieved from server in Edge ?
Server side - ASP.NET Core