1

Is there a way to convert the below response which I got from the Chrome Dev Tools to a PDF file?

%PDF-1.5
%âãÏÓ
38 0 obj
<<
/Type /XObject
/Subtype /Image
/Width 189
/Height 100
/ColorSpace /DeviceGray
/Matte [0 0 0]
/BitsPerComponent 8
/Interpolate false
/Filter /FlateDecode
/Length 3345
>>
.....

I know this is the RAW PDF data so I tried to create a pdf file out of this in Node.js but the output was a blank PDF file.

There's some conversion missing which I am not able to figure out. Any sort of help is deeply appreciated

Whyashh
  • 93
  • 9
  • 1
    Could be a codepage problem e.g. maybe you're reading the response as text, instead of binary data (ArrayBuffer or Blob). – wOxxOm Oct 21 '20 at 05:02
  • @wOxxOm I got the above data from inspecting in the Network tab of Chrome Dev Tools. Was thinking if I can take that response and write in binary to a pdf file. Am I making sense? – Whyashh Oct 21 '20 at 06:53
  • I don't understand what you mean by "take". You can't do it by copypasting certainly. – wOxxOm Oct 21 '20 at 08:08
  • @wOxxOm yes most certainly. There is a response tab when you click on a network request, and you can see what the request returned (in raw form). Was thinking is there a way I can take whatever is returned and create a PDF file out of it – Whyashh Oct 22 '20 at 06:17
  • You can do it in devtools-on-devtools, see [this example](https://stackoverflow.com/a/57782978) and [this](https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server). – wOxxOm Oct 22 '20 at 06:23

0 Answers0