I have a PDF data that coming from a 3th party service starts with this:
%PDF-1.3 %���� 5 0 obj << /Type /Page /Parent 1 0 R /LastModified (D:20220519105837 02'00') /Resources 2 0 R /MediaBox [0.000000 0.000000 595.276000 841.890000] /CropBox [0.000000 0.000000 595.276000 841.890000] /BleedBox [0.000000 0.000000 595.276000 841.890000] /TrimBox [0.000000 0.000000 595.276000 841.890000] /ArtBox [0.000000 0.000000 595.276000 841.890000] /Contents 6 0 R /Rotate 0 /Group << /Type /Group /S /Transparency /CS /DeviceRGB >> /PZ 1 >> endobj 6 0 obj <> stream x�3�357�r/ �R��R)@���\N! �n�
and I would like to provide this PDF data to my visitors via a web page. Currently, I am setting application/pdf; charset=UTF-8
and CONTENT_DISPOSITION
as inline on my response with this data.
But I am getting a blank PDF layout page on my webpage. Like that:
Do you know how can I show this PDF data on browser correctly?
CodePudding user response:
Special thanks to @mkl It seems I need to evaluate 3rd party service response as byte. Then I convert it to base64 and decode it to string with charset ISO-8859-1.
Lastly, I put this string on HTML with application/pdf; charset=ISO-8859-1
content type.