datauristring pdf open in php

To open a PDF file in PHP using a data URI string, you can use the following code:

<?php
$file = 'path/to/your/file.pdf';
$data = file_get_contents($file);
$base64 = base64_encode($data);
$dataUri = 'data:application/pdf;base64,' . $base64;

echo '<embed src="' . $dataUri . '" width="500" height="600" type="application/pdf">';
?>

Replace 'path/to/your/file.pdf' with the actual path to your PDF file. This code reads the file contents, encodes it in base64, and creates a data URI string with the appropriate MIME type for a PDF file. The embed tag is then used to display the PDF in the browser.

Please note that this code assumes you have the necessary permissions to access the file and that the file exists at the specified path.

I hope this helps!