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

214
Vistas
How to download pdf files one by one using pdfmake

I am new here and i need your help to find a solution for my crash problem.

I am building a reactjs app and creating a pdf document and then download it by using

pdfmake.createPdf.download

However, when pdf size is too big, browser gives error and crashes. Therefore, I am trying to divide pdf into smaller chunks and download them one by one. But it executes all download methods and downloads multiple pdf at the same time. And this does not solve my issue because I believe I need to give back the allocated memory in order to prevent the crash.

I searched for answers but none of them worked in my case. Still crash happens.

Here is how my code basically looks like

exportPdf(rowData)
{
    let org = rowData.details;
    let startIndex = 0;
    let endIndex = 0;
    while(lastIndex != -1)
    {
        startIndex = endIndex;
        endIndex += 25;
        if(endIndex > org.length)
        {
            lastIndex = -1;
        }
        rowData.details = org.slice(startIndext, endIndex);
        pdfMake.createPdf( createDocumentContent(rowData) ).download();
    }

}

I want Chrome to download the file for every iteration. I tried to use Promise, setInterval but didnt work. I also increased nodejs heap size by increasing --max_old_space_size to prevent the crash, also didnt work.

I use react scripts to create build and deploy it under webbapps for apache-tomcat-9.0.14. And my node version is v10.15.3.

I appreciate any help you can offer.

Thanks in advance.

about 4 years ago · Santiago Trujillo
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