Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
¿Cómo agrego el símbolo de salto de página en un archivo txt generado a partir de mi código js?

Este es mi código para extraer datos de mi tabla html e imprimirlos en un archivo .txt :

 $('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();

Quiero agregar un símbolo de salto de página cuando count=40 , para que la impresora de línea comience a imprimir desde la página siguiente cuando obtenga el símbolo. ¿Cómo lo agrego?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Como lo sugirieron @Tim Roberts y @CBroe, al agregar el carácter de alimentación de formulario '\f' funcionó:

 if(count==40){ userDetails+='\f'; count=1; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!