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

213
Visualizações
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 à 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