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

6.1K
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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