Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

358
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda