PDF as a blank page in HTML

My problem is that everyone opens with PDF files using my browsers until I have downloaded the pdf file inside. Then, if I insert it, it returns a blank page. But other pdf files with forms open normally. See my code below:

<object data="{{ asset($test->file_path) }}" type="application/pdf" width="100%" height="100%">
    <embed src="{{ asset($test->file_path) }}" type='application/pdf'>
    <center>
        <a href="{{ route('download.test', ['id' => $test->id]) }}" class="btn btn-primary">Please click here to view</a>
    </center>
</object>

Note. I also tried using <iframe>, but still returns a blank page.

Decision:

option1:

Renamed my #icon file . And everything should work fine.

option2:

Use if necessary urlencode.

+6
source share
4 answers
<a href="{{ route('download.test', ['id' => $test->id] ,['target'=>'_blank']) }}" class="btn btn-primary">Please click here to view</a>
+5
source

, , , .

, PDF , HTTPS. , HTTPS, HTTP.

, PDF , HTTPS, , PDF, HTTPS.

+1

iframes ( )

- :

<object data="http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf" type="application/pdf" width="100%" height="100%">
    <iframe src="http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf" width="100%" height="100%" style="border: none;">
        This browser does not support PDFs. Please download the PDF to view it: <a href="/pdf/example.pdf">Download PDF</a>
    </iframe>
</object>

, , JSFiddle, HTTPS. , : https://pdfobject.com/static.html

0

, , . , . http://yoursite.com/the.pdf .

<object data="http://yoursite.com/the.pdf" type="application/pdf" width="750px" height="750px">
    <embed src="http://yoursite.com/the.pdf" type="application/pdf">
        <p>This browser does not support PDFs. Please download the PDF to view it: <a href="http://yoursite.com/the.pdf">Download PDF</a>.</p>
    </embed>
</object>
0

All Articles