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

151
Visualizações
Convert html page to pdf without degrading the quality

i'm trying to convert a html document to a pdf using javascript but the quality is significally lower than it should be ( text is blurry, colors are not pure ,... ) even though it's displaying fine in my web browser.

here is the pdf generator function i'm using :

public convertToPDF()
{
  let domElement = this.pdfTable.nativeElement as HTMLElement;
  html2canvas(domElement).then(canvas => {
    // Few necessary setting options
    var imgWidth = 210;
    var pageHeight = 750;
    var imgHeight = canvas.height * imgWidth / canvas.width; 

    var heightLeft = imgHeight;

    const contentDataURL = canvas.toDataURL('image/png')
    let pdf = new jspdf('p', 'mm', 'a4'); // A4 size page of PDF
    var position = 0;
    pdf.addImage(contentDataURL, 'JPG', 0, position, imgWidth, imgHeight)
    pdf.save('new-file.pdf'); // Generated PDF
  });
}
about 4 years ago · Santiago Gelvez
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