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

6.1K
Visualizações
Show binary pdf as link on website

I've got a variable that gets the pdf as a binary file into the website

<?=$calculationData->PDF_file?>

How do I show the pdf as a link, instead of binary text? Note: I'm a newbie at this and don't know a lot about php! :-)

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I assume $calculationData is an object from a database and the PDF content is stored there as binary data. Then you can do something like this:

Link to a PHP file that loads the content and sends it to the browser.

<a href="show_pdf.php?id=555">

Where id is the id of your calculationData somewhere in the database in this example. You need something to identify it.

show_pdf.php:

<?php
/* load your calculation data here ... */

header("Content-type: application/pdf");
header("Content-Disposition: attachment;filename='mywhateverfile.pdf'");

echo $calculationData->PDF_file;
exit();

In that way you can send the binary data to the browser and telling it with the correct headers, what to do with that data.

over 4 years ago · Santiago Trujillo Relatório
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