I am receiving PDF stream data from an AJAX call (that I post data to) and I have to convert this into something I can use to ultimately display it a PDF inside an iFrame tag. I do not have access to the API to make further changes so back-end modifications will not be possible. I have to solve this on the client-side using Javascript only and without the use of a JS library.
I have researched for hours and have found multiple solutions, but in the end, none work including the btoa() methods, converting this to a BLOB and using URL.createObjectURL(blob)...
I have no idea what this data even is. Is this a byte array because it sure does not look like one. I don't know what else to do.
The backend has the 'ContentType' to 'application/pdf' and the Content = newByteArrayContent(MemoryStream.ToArray()) for an HttpResponseMessage object to be set as the API response. Any help would be tremendously appreciated!
Thank you all in advance!
Please note that the code below is not complete. It is just a snippet.
%PDF-1.4
%����
6 0 obj
<<
/ProcSet [/PDF /ImageC /Text]
/Font
<<
/F10 7 0 R
/F20 9 0 R
/F30 11 0 R
/F40 15 0 R
>>
/XObject<<
/Im1 13 0 R
>>
>>
endobj
13 0 obj
<<
/Type /XObject
/Subtype /Image
/Width 1000
/Height 600
/ColorSpace /DeviceRGB
/Decode [0 1 0 1 0 1]
/BitsPerComponent 8
/SMask 14 0 R
/Length 27501
/Filter [/DCTDecode]
>>
stream
+���צ�j�χ��sV9f���3���� �&�_���d�:Ԕz��F�0㮏UQ��������������Z���
�:3G�C��4��C�}��e����@B��';q��ݨԫ7k�g���J��3�R\,b��(����`� oU��oBi��%ԚdӍ�2�M�TP����I�S�H���ӎ0!̱�0�Eh�
��;)����|�2{8��/�hɠ�8��_O�9O���:��5���ߞM��܀�5a<����Ū9�WdE��M���1�n���ᖎE`<R��7Ӽԇ3��[�<M�Ё���#zad� |�/NȻ8�AJ�S{ߠQ��[�w���h4���a3�^{�7�i���y���x�E�{�v 8h��,�#�������løh98�,R�����t֤}�tt��5�굱F���t�i��n����;�l��d����M��>D�m���*�uJN`{�����}�T�N�'5�ę�]�d[�ۘ��N����H�|n�|�lm�m��b윃w9
�����ai�o���s
...
...
...
%%EOF