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

356
Visualizações
How do I add the page break symbol in a txt file generated from my js code?

This is my code to extract data from my html table and print them in a .txt file:

 $('table tbody tr').each(function(){
       count+=1;
       var detail='';
       var arr1=[];
       $(this).find('td').each(function(){
            detail=$(this).text();
            arr1.push(detail);
       });
       detail='';
       for(var k=0;k<arr1.length;k++){
            detail+=arr1[k];
            detail+='     ';
       }
       userDetails+=detail+"\r\n";
       userDetails+='--------------------------------------------------------------------------------------------------------------------------------------------------------------------';
       userDetails+='\n';
       if(count==40){
           //add page break symbol here
           count=1;
       }
 });
 var a = document.createElement('a');
 var file = new Blob([userDetails], {type: 'text/plain'});
 a.href = URL.createObjectURL(file);
 a.download = "IPAS_electric_data.txt";
 a.click();
 a.remove();

I want to add a page break symbol when count=40, so that the line printer starts printing from the next page when it gets the symbol. How do I add it?

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

0

As suggested by @Tim Roberts and @CBroe, adding the formfeed character '\f' worked:

if(count==40){
     userDetails+='\f';
     count=1;
}
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