Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ashraam's avatar

Laravel and viewerjs

Hi everyone,

I Have to display a PDF inside my view and I used viewerjs on other project (not laravel projects btw) it was perfect for my need.

But I've got a problem with Laravel.

Here is my template:

<div class="panel panel-inverse">
            <div class="panel-heading">
                <h4 class="panel-title">Prévisualisation du contrat</h4>
            </div>
            <div class="panel-body">
                <iframe src="/ViewerJS/#/./generate/test.pdf" width='100%' height='800'></iframe>
            </div>
        </div>

My ViewerJS folder is in the public directory and test.pdf is also in the public directory (public/generate/test.pdf)

The viewer always throw a 404 not found error.

I've tried many url to reach test.pdf but I didn't find the good one.

Can someone help me.

If you have another good library to display PDF file in the view do not hesitate to tell me ;)

Thanks !

0 likes
1 reply

Please or to participate in this conversation.