DEV Community

Shubham Sharma
Shubham Sharma

Posted on

PDF binary format encoded to previewable decoded

%PDF-1.5\n%����\n4 0 obj\n<>/Type/XObject/ColorSpace/DeviceRGB/Subtype/Image/BitsPerComponent 8/Width 170/Length 617/Height 170/Filter/FlateDecode>>stream\nx���Q��0DA���3gL6)���f[�h�ϟ>�c\t��������������������.�R��������KV?~����Ǐ���r.}A8�u�V?~����Ǐ���XYL�����/\nendstream\nendobj\n22 0 obj\n<<0ed1f263d4074e258814cda9d1dfa204>]/Length 72/Info 21 0 R/Size 23/Filter/FlateDecode>>stream\nx�%��� C�,����=�J���;��L&��T$8�45��3���;�A���A�\n;������C$�u�|\nendstream\nendobj\nstartxref\n3277\n%%EOF\n

have this pdf data what i wish to do is convert this into buffer's of data whicch i can preview it's like encoded data i am noot able to deccode it and save have tried multiple things to do const decodedPdfData = Buffer.from(rawResponse, 'base64'); const decodedPdfData = Buffer.from(rawResponse, 'binary');

can anyone please let me know way to do this ?

I am expecting pdf buffer's which i can preveiw and save it to cloud but issue is this while saving through above method it seems empty or damaged

node.js

Top comments (0)