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

306
Visualizações
download pdf generated by jspdf with non-default title

This is my first time using jspdf so please forgive me if this is a basic problem.

I have successfully generated the pdf, opening it in a new tab on my browser, with correct filename displayed on topleft. However, when I try to download the file, the filename is not the one thats shows there but the default "download.pdf" no matter what file it is.

I figure out that the simplest solution is

const doc = new jsPDF();
// add some content here.
doc.save("the real file name i want.pdf");

which saves the file locally with no issue, however, I still want to see the file on the browser first and then decide whether to download it or not......

I did some research around, these posts are relevant but they either do not directly solve my issue or seems kind of outdated.....

How to open generated pdf using jspdf in new window

Download PDF file using jsPDF

So far, my best approaches were:

doc.output('dataurlnewwindow'); // open in a new tab but save with default name
window.open(doc.output('bloburi', {filename: `${name} pos.pdf`}), '_blank') // open in a new tab but save with blob name

Any help will be appreciated, thank you in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you create an object URI, the filename can't be altered so you could instead use a pdf viewer library to display it inline so that you can alter the download button to work or upload it to some server so that you can customise the name.

about 4 years ago · Juan Pablo Isaza Relatório
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