This topic is locked
[SOLVED]

 Inline view of PDF saved in Blob possible?

5/31/2017 11:13:37 AM
PHPRunner General questions
mbintex author

Hi,

is there any way to show a PDF in an inline frame that is saved in a blob inside the database?
Want to do the same as here:
http://www.asprunner.com/forums/topic/20629-iframe-on-edit-page/

mbintex author 5/31/2017

With this button I can view the PDF without the hassle of downloading (Dokumentis the blob field containing a PDF):
Server

$record = $button->getCurrentRecord();

$result["Adresse"]=base64_encode($record["Dokument"]);


Client After

var urladresse = "<p><embed src='data:application/pdf;base64,"+result["Adresse"]+

"' WIDTH='700' HEIGHT='550' SCROLLING='No'></embed></p>";
Runner.displayPopup( {
html: urladresse,

header: 'PDF Ansicht',

width: 800,

height: 700
});


Works nice in Safari and Chrome, but not in Edge.
Now, why does the following code snippet not work anywhere ?

global $pageObject;
$record = $pageObject->getCurrentRecord();

$pdfresult = base64_encode($record["Dokument"]);
$urladresse = "<p><embed src='data:application/pdf;base64,".$pdfresult.

"' WIDTH='700' HEIGHT='550' SCROLLING='No'></embed></p>";
echo $urladresse;
mbintex author 5/31/2017

And finally this works as a codesnippet and gives inline PDF viewing in Chrome, Safari, but not Edge (because it can´t).

global $pageObject;
$record = $pageObject->getCurrentRecord();

$datensatz = $record["ID"];
$abfrage="select Dokument from Dokumente where ID=".$datensatz;
$pdfdatei=DBLookup($abfrage);
$pdfresult = base64_encode($pdfdatei);
$urladresse = "<p><embed src='data:application/pdf;base64,".$pdfresult.

"' WIDTH='700' HEIGHT='550' SCROLLING='No'></embed></p>";
echo $urladresse;