title: How to fix `URIError: Failed to decode param` pdf body received from backend?
body: <p>So from the backend I am receiving a pdf binary like this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>"%PDF-1.3\r%����\r%PDF-Writer.NET dbAutoTrack Ltd.\r2 0 obj\r&lt;&lt;\r/Creator (Online)\r/CreationDate (D:20220411184728+02'00')\r/ModDate (D:20220411184728+02'00')\r&gt;&gt;\rendobj\r3 0 obj\r[/PDF /Text /ImageC]\rendobj\r7 0 obj\r&lt;&lt;\r/Type /XObject \r/Subtype /Image \r/Name /I0 \r/Length 76843 \r/Width 1545 \r/Height 2000 \r/Filter /DCTDecode \r/ColorSpace /DeviceRGB \r/Decode [0.0 1.0 0.0 1.0 0.0 1.0]\r/BitsPerComponent 8\r&gt;&gt;\rstream\r\n����\u0000\u0010JFIF\u0000\u0001\u0001\u0001\u0000`\u0000`\u0000\u0000��\u0000C\u0000\b\u0006\u0006\u0007\u0006\u0005\b\u0007\u0007\u0007\t\t\b\n\f\u0014\r\f\u000B\u000B\f\u0019\u0012\u0013\u000F\u0014\u001D\u001A\u001F\u001E\u001D\u001A\u001C\u001C $.' \",#\u001C\u001C(7),01444\u001F'9=82&lt;.342��\u0000C\u0001\t\t\t\f\u000B\f\u0018\r\r\u00182!\u001C!22222222222222222222222222222222222222222222222222��\u0000\u0011\b\u0007�\u0006\t\u0003\u0001\"\u0000\u0002\u0011\u0001\u0003\u0011\u0001��\u0000\u001F\u0000\u0000\u0001\u0005\u0001\u0001\u0001</code></pre>
  </div>
  </div>
  </p>
  <p>Then in my angular frontend app I do this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> this.api
        .GetPrintedInvoice(invoiceID) 
        .then((res) =&gt; {
          console.log("RES",res)
          window.open(res);
        });
    }</code></pre>
  </div>
  </div>
  </p>
  <p>EDIT:</p>
  <p>This is how I parse it to the example response above:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>parser.parseString(body, function(err, result) {
      request.get({
        url: result.feed.entry[0].content[0]['m:properties'][0]['d:Url'][0],
        headers: {
            'Authorization': auth.Item.token_type + " " + auth.Item.access_token,
            "Content-Type": "text/pdf"
        }
      }, async function(err, httpResponse, body) {
         console.log(body);
       
        console.log(typeof body)
   
        callback(null, body);
       
      });
    });</code></pre>
  </div>
  </div>
  </p>
  <p>This returns me the error from the title. I want to be able to get this response and display it as PDF and eventually be able to download it but I am not sure how to do that.</p>