Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

403
Visualizações
PDF Raw data - what is this? And how can I use it to display in an iframe or PDF.js viewer

Hello Stack Overflow.

I need help, I am trying to store PDFs offline on a PWA. But first I simply want to retrieve the PDF from the Wordpress REST API and display it in a iframe or even better Pdf.js.

I have successfully managed to GET the a PDF from the API. When testing in postman it displays the PDF that I can scroll through. However, when using the same GET request in a async axios request I get the following.

// Request
async getPDFTest() {
    if (typeof indexedDB === 'undefined') {
      this.supported = false;
    }

    await axios.get('https://staging-nasapi.kinsta.cloud/wp-content/uploads/2021/08/Transitions-PG_E.pdf')
      .then((response) => {
        // handle success
        const pdf1 = response;
        console.log(pdf1);
      })
      .catch(() => {
        // handle error
        console.log('Error getting offline PDF');
      });

    return new Promise((resolve) => {
      resolve();
    });
  },
};

See console log message below. Image of console log

How can I get this PDF data into an Iframe or Pdf.js?

Thanks

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda