如何在Php laravel中创建pdf查看器(pdf文件的thumpnail)

时间:2018-04-06 09:26:15

标签: php html pdf viewer

我有网页显示和下载上传的pdf文件所以我需要在网页上显示pdf内容我已经创建了一个图像页面我必须使用pdf而不是图像

以下是我的观点:



<div class="row">
<?php foreach ($rowData as $key => $row) {
    ?>
    <div class="col-md-3">
        <div class="card" style="width: 15rem;">
            <?php
            $allowed = array('png', 'jpg');
            $filename = $row->file;
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            if (!in_array($ext, $allowed)) {
                //echo ' <img class="card-img-top" src="http://via.placeholder.com/350x150" alt="" height="300">';
                ?>
                <img class="card-img-top" src="{{asset('/uploads/images/no-image.png')}}" alt="" height="250">
            <?php
            } else {
                ?>
                <img class="card-img-top" src="{{asset('/uploads/downloads/'.$row->file)}}" alt="http://via.placeholder.com/350x350" height="250">
            <?php } ?> 
            <div class="card-block">
                <h6 class="card-title">{{$row->title}}</h6>
                &nbsp &nbsp &nbsp &nbsp &nbsp   <a download="{{$row->file}}" href="{!! asset('/uploads/downloads/'.$row->file) !!}" target="_blank" role="button" class="btn btn-primary btn-sm">Download</a>
            </div>
        </div> 
    </div>
    <?php }
?>
</div>
&#13;
&#13;
&#13;

我想像这样创建pdf viewer click

1 个答案:

答案 0 :(得分:0)

你可以在laravel中使用 DomPDf