Here is what I tried
I get some binary string sending a GET request to some API
let BinaryData = await Operations._sendRequest(baseURL + '/getBinaryString/', 'GET');
above Request give to me like this string
"%PDF-1.4
%����
4 0 obj
<</Length 5076/Filter/FlateDecode>>stream
x���Kw�F���� Xxa�c� ���\��g��.��E{ ,���-�e����}
................................................................
startxref
5701
%%EOF
"
Firstly I try to encode this string
const encoder = new TextEncoder()
let encodeBinaryData = encoder.encode(BinaryData)
Then I convert it to blob
let blob = new Blob([encodeBinaryData],{type: "application/pdf"});
Finaly I am going to show this data in Iframe
let frame = document.createElement('iframe');
frame.src = window.URL.createObjectURL(blob);
let par = document.getElementById('pdf');
par.appendChild(frame);
Now IFrame is empty, It not show the data.Above binary has a table data. I can sent the following responceType to API, But I dont want to use that way
responceType:"blob"
if I send the responceType as blob I can get tha data as BLOB and send it to iframe and show as PDF I can see my all data there.
But I want to show the PDF data using above code. I tested if I can show the string in iframe
let str = "Hello World"
let encodeBinaryData = encoder.encode(str)
let blob = new Blob([encodeBinaryData],{type: "text/plain"});
Then I can see correct string there, EX: Hello world
But If I use {type: "application/pdf"} I cant see anything
how Can I fix this problem? (I am using pure HTML)