0

I am getting below characters, when i try to download pdf from one of the micro-service and trying to display in other window.

%PDF-1.5 %���� 3 0 obj <>stream x�m�=1����w<�;�V�ި��� t��}��!��7-��B��I�\��UZ��i�ɖ_��Ӟ��)ƛ�M7a�����F�K$��5Ǝ��?c���P�+�b��A\QڏxŜ5d�V��x�KN}W2�?kG}�t�9�-� endstream endobj 1 0 obj <>/Contents 3 0 R/Type/Page/Resources<>/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]/Font<>>>/Parent 4 0 R/Rotate 90/MediaBox[0 0 49 802]>> endobj 5 0 obj [1 0 R/XYZ 0 59 0] endobj 2 0 obj <> endobj 4 0 obj <> endobj 6 0 obj <> endobj 7 0 obj <> endobj 8 0 obj <>>> endobj 9 0 obj <> endobj xref 0 10 0000000000 65535 f 0000000234 00000 n 0000000518 00000 n 0000000015 00000 n 0000000606 00000 n 0000000484 00000 n 0000000669 00000 n 0000000723 00000 n 0000000755 00000 n 0000000858 00000 n trailer <<5dd6d332be4a095e01bd89b772db2abf>]/Root 8 0 R/Size 10>> startxref 1025 %%EOF

I belive some thing wrong in setting content-type. Please provide me solution for this.

Rh.one('<asdf/sdf/sd/myapi/>').post('',reportsParameters)
      .then(function (response) {
          var winPrint=$window.open('','_blank');
          winPrint.document.write(response);
          winPrint.document.title = $scope.reportPostParamters.fileName;
}
shivadarshan
  • 896
  • 2
  • 15
  • 25
  • I believe either the headers being sent or received are incorrect, they should be `application/pdf`. Alternatively, instead of trying to download the .pdf and open it in a new tab, can you not just open the link to the .pdf in a new tab? – Gary Thomas Jan 25 '19 at 12:44
  • @GaryThomas, we receive only pdf bytebuffer from API. need conversion from bytearray to pdf document in new tab.. – shivadarshan Jan 25 '19 at 12:50

0 Answers0