-1

i tried to display pdf in "home.blade.php" page but it not displayed pdf but showing empty blank page.

i stored pdf file in "public" folder

i tried below 2 different codes but not work

<iframe src="{{URL::to('/WEBSITE-FILE')}}/test.pdf" width="100%" height="600"></iframe>

<iframe src="WEBSITE-FILE/test.pdf" class="pdf-spacing-verify pdf-view-for-mainnet-verify" id="pdf_display_frame" width="100%" height="500px"></iframe>
aynber
  • 22,380
  • 8
  • 50
  • 63
Ramu Ramu
  • 27
  • 2
  • 13

1 Answers1

0

Alright i thought something was wrong with my code when i try to display pdf in the browser, it was opening in google chrome browser but not in mozilla firefox so it turns out my pdf is in download mode and then i changed it into "Preview in firefox". Please check in both browser that pdf is in viewing mode.

Firefox browser

enter image description here

Chrome browser

enter image description here

After that please check that you're pdf file is accessible via URL.

<html>
<body>
<iframe
    src="{{ url('storage/images/sample.pdf') }}"
    style="width:400px; height:500px;"
    frameborder="0"
></iframe>
<object data="{{ url('storage/images/sample.pdf') }}" type="application/pdf"   style="width:400px; height:500px;">
    <p>Alternative text - include a link <a href="{{ url('storage/images/sample.pdf') }}">to the PDF!</a></p>
</object>
<embed src= "{{ url('storage/images/sample.pdf') }}"   style="width:400px; height:500px;">
</body>
</html>

In case if you're not be able to access pdf via url, make sure you're path is correct in case of storage : make sure symlink is created.

I hope this helps.

Vipertecpro
  • 3,056
  • 2
  • 24
  • 43