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

154
Visualizações
Declare new height and width for every new page on added jspdf using javascript
var doc = new jsPDF('px','px', [388, 2401]); 
var width = doc.internal.pageSize.getWidth;
var height = doc.internal.pageSize.getHeight;
doc.addImage(img, 'JPEG', 0, 0, width, height);
doc.addPage();
doc.addImage(img1, 'JPEG', 0, 0, new_width, new_height); // another image 
doc.save("gg.pdf");

How can I re assign new width and height for every new image on jspdf as new jsPDF('px','px', [388, 2401]); only works for first image any way to do so that I can set new width and height for every image I add to pdf? Any suggestions would be appreciated.

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

0

We seem to agree that px appears to be applied as 54 per inch

// We must declare 1st page canvas before use "p", is for portrait then default units , [size x, size y] 
var doc = new jsPDF("p", "px", [388, 2401]); 
var width = doc.internal.pageSize.getWidth;
var height = doc.internal.pageSize.getHeight;
doc.addImage(img, 'JPEG', 0, 0, width, height);

// oddly the order for new page is reversed, so size, then orientation
doc.addPage([new_width, new_height], "p");
doc.addImage(img1, 'JPEG', 0, 0, new_width, new_height); // another image
 
doc.save("gg.pdf");

However always check the scaling these 2 should be same units just rotated, they report same dimension and appearance of difference is perhaps an illusion. Same file, facing pages, one pane set as MangaMode

enter image description here

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