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

372
Visualizações
PHP Problem with saving of inline pdf in Chrome and Edge

I've made a small program to search and display an PDF-file, some years ago. The PDF-file is shown inline, so the user can verify that it is the correct file. Usually he then uses the download button of the adobe plugin to save the file on his PC.

Since end of may this makes problems with Microsoft Edge and Google Chrome. The file is displayed correctly and when the user clicks the download button the save dialog opens, but when he presses the save button the file is not downloaded (error message "network error"). Strange thing is, that the print button next to the download button works.

On Firefox the whole thing still works. Each browser is updated automatically.

This is the code I use to display the pdf file:

        header('Content-Type: application/pdf');
        header('Content-Disposition: inline; filename="' . $deliveryPdf->getFilename() . '"');
        header('Content-Transfer-Encoding: binary');
        header('Accept-Ranges: bytes');
        echo $deliveryPdf->getData();

Some notes, I recognized while analyzing the problem:

  • On Edge and Chrome the save dialog does not use the filename given in the response headers, while firefox uses the correct name
  • When using the "download" or "print" button in the adobe view, there is no additional request to the webserver (on none of the browsers). The only request on the webserver appears when initially opening the pdf
  • The print button works fine on all browsers. This raises the question where the difference between download and print is, when they both seem to use the cached file.
over 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