HTTP request getting PDF as a string

Dear all,

I´m getting from an API the PDF data as a string. When testing with Postman it shows the PDF and I can save it. But when working with Node-Red I can´t process that data any further.
Just for testing I tried to save the file to a PDF but it is corrupt.

Header:

{"date":"Mon, 29 Nov 2021 07:43:40 GMT","server":"uvicorn","content-type":"application/pdf","content-disposition":"attachment; filename=\"2021-11-26 hello world.pdf\"","vary":"Accept, Accept-Language, Origin, Cookie","allow":"GET, HEAD, OPTIONS","x-frame-options":"SAMEORIGIN","x-api-version":"2","x-version":"1.5.0","content-length":"17270","content-language":"en-us","x-content-type-options":"nosniff","referrer-policy":"same-origin","connection":"close","x-node-red-request-node":"150e4588"}

Payload (string)

%PDF-1.7%����1 0 obj<< /Type /ObjStm /Length 704 /Filter /FlateDecode /N 11 /First 67 >>streamx�uTmk�0��_qߖR[r�6J ��.�4!����RQ�2�Ϳߝ�Y��`Kw���sϙ��1��'!��"�b�� ��!q`Rz�W��o����`��[��j�������P�o%���t�m{�x3�,��ca6i���0Xt��6�A��P���JXm�LX���9c�G�s�׾��ޏ@L^O��a��`����jU���r��Yew0�!à��p�Q�o����6W\�E�|�"�ն�X���k�:�33mi���]K�"�����{���Z(��ԼbQ��'86LҎ��{>ת1m�#^aV�zS�\����i��|�j<vM�ee1�Gtx[�j�Lo%R��0�ͦ�QعW6]9lo�-���(�s���T��R�Ғ�I���-s#u�au�m�g�RZ_�G��G�/�R�j!|Qⓐ�oJ��c���M�!�ؓ�\�'-Q�:��t���N��zG���9JV�r�3�T�4�ɣ���a/V��ˢ��ZW��s�k\�� �=l�<8�,�\)�Դs���&-6��)*p��v�eg8a}��E�s�Z�y�95X����p�o��~�-D�[d/{����]%����A����=��6�1r���<	���%�Qg���!�=�-,k�j�Π����H�{�����4ϊi��P���C�aeb�endstreamendobj13 0 obj<< /Subtype /XML /Type /Metadata /Length 1340 >>stream<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP toolkit 2.9.1-13, framework 1.6"><rdf:RDF xml...

anyone able to push me in the right direction? I somehow searching for a solution for two days now.

Thanks
Philipp

a pdf is not a string but a binary, depending how you are retrieving it (i assume a http-request node), you can set it to a binary buffer and save it to a file.

you just saved me. I was so fixed on all other nodes that I did not check the request node at all.
please send me your paypal address. I want to buy you lunch! THANKS

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.