Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
How to use javascript (in Angular) to get bytes encoded by java.util.Base64?

Since the functions related to DispatcherServlet are implemented by another department of my company, I can only complete the specific business classes of the back-end and the front-end, so I cannot directly return byte[] to the front-end.

So I use

                    Base64.getUrlEncoder().encodeToString(bytes);
                    response.put("data", data);

to return a RESTful json response to my front-end.

But in Java encodeToString, BASE64 util converts the bytes to BASE64 bytes and then returns a String based on ISO_8859_1...

First, How can I convert the string to the ISO_8859_1 byte[]?

Second, How can I decode the byte[] encoded by BASE64?

in frontEnd,

        this.http.pdf(data).subscribe(
          resp => {
            const data = WhatShouldTheMethodBe(respo['data']); //What should the method be?
            let blob = new Blob([data], { type: 'application/pdf' });
            let url = window.URL.createObjectURL(blob);
            let pwa = window.open(url);
            if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
              alert('Please disable your Pop-up blocker and try again.');
            }
          }
        );

Thanks a lot.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!