Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

6.1K
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!