0

I'm using the below script to display the PDF in browser.

$vPath = '/path/to/pdf/example.pdf';

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

The PDF files are on the same server where the script is. But now I have to move the PDF to image server(Only PDF and Image files resides here)

How can I display the PDF from another server? Please help

George
  • 31
  • 6
  • possible duplicate of [Serving file hosted on another server as download](http://stackoverflow.com/questions/5440270/serving-file-hosted-on-another-server-as-download) – rpax Jun 06 '14 at 06:56
  • Redirecting the user to the URL of the PDF isn't okay? – Brilliand Jun 06 '14 at 21:13

1 Answers1

1

Thanks guys.

I did a work around. The problem with using the above code is the relative path used. Instead I used IFRAME for displaying PDF using absolute path.

$vPath = 'http://path/to/pdf/example.pdf';
<iframe src="<?php echo $vPath;?>" style="width:600px; height:500px;" frameborder="0"></iframe>
George
  • 31
  • 6