Display pdf file using php

preview_player
Показать описание
There are certain situations when we require to display pdf file using php. At that time what we have to do?
The answer is in this video
Рекомендации по теме
Комментарии
Автор

Here's The Code:

<?php
$file = 'placement.pdf';
$filename = 'placement.pdf';

header('Content-Disposition: inline; filename"' . $filename .'"');
binary');
header('Accept-Ranges: bytes');
@readfile($file);
?>

ra
Автор

Thanx for tut. it worked(even with iframe). There's also two js libraries for pdf: PDFObject.js and pdf.js

ra
Автор

sir i have one question, how to upload/download pdf, word file using php mysql??? plz it is very urgent

kaneezfatima
Автор

Do you can show me how to disable print in brower (protection pdf document). Thanks!

thuytruongluu
Автор

this is my code and the result is showing some special character in output of the file
$file = 'dummy.pdf';
$filename = 'dummy.pdf';

header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');

@readfile($file);

JahulHasan
Автор

Is this method applicable on word documents too? Thanks.

dancanua
Автор

how about write on the pdf before displaying ?

jinos
Автор

i want to display the pdf file which is stored into the database.how can we get the $file?i am using xampp server.please help me as soon as possible.

palashsaha
Автор

what to do for doc image and ppt files

subhanginayak
Автор

it shows for a while in my browser. please help me fix this

WHIPFLASHx
Автор

Thank you for this! Saved a lot of time for me!

IHemrick
Автор

I followed all the steps and copied the code but still it is not viewing the pdf file. It only commands to download the file. why is it? I need an answer pls.

mharnza
Автор

how to disable icon print and download?

wahyuartadianto
Автор

Can you also do a video on editing on pdf document from here? Thanks a lot

arunec
Автор

can we use same process for other files as well like doc, ppt etc

mebondify
Автор

Why name it showing as pdf.php how can we change that name when you showing any pdf in chrome browser

bipinmishra
Автор

It's goog but can you tell me...how to display a non downloadable PDF file?

chandansarkar
Автор

How to Create PDF with FORM data Using Php and html, I need it,

shahindomar
Автор

Does this still work?
I've done exactly this, and tried to run it in chrome and it doesnt work

lucascessford
Автор

hello everyone, Is there anyone who knows PHP codes for downloading multiple files from the database?

denismula