Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Blob pdf Dont renderize

Rogoerio

New Coder
Hello, people, i receive a blob pdf, from my api, the pdf renderize but no content, i tested in postman and works, and i use the same function adapted in another front angular and same api and works. thanks a lot
 

Attachments

  • Screenshot_16.png
    Screenshot_16.png
    3.9 KB · Views: 4
  • Screenshot_13.png
    Screenshot_13.png
    17.9 KB · Views: 5
  • Screenshot_14.png
    Screenshot_14.png
    4.9 KB · Views: 5
  • Screenshot_15.png
    Screenshot_15.png
    4.5 KB · Views: 4
Hi there @Rogoerio,

Can you please share your code within the thread as well? It's much easier for us to read and would allow us to copy and paste it into our editors to test.
 
Ok, lets go,

Code:
 function print() {

        let payload = { arquivo: { id: $routeParams.id } };

        Api.POST("arquivo", payload, {responseType: 'blob'})
        .then(function (result){
            var file = new Blob([result.data], {type: 'application/pdf'});
            var fileURL = window.URL.createObjectURL(file);
            window.open(fileURL);
                console.log("Teste1", result.data);
                console.log("Teste2", file);
                console.log("Teste3 ", fileURL);
          });
      }
 
Back
Top Bottom