Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: header and footer image not loading #69

Closed
RVP04 opened this issue Feb 3, 2024 · 0 comments
Closed

[Bug]: header and footer image not loading #69

RVP04 opened this issue Feb 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@RVP04
Copy link
Contributor

RVP04 commented Feb 3, 2024

What happened?

header blade

<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        .header {
            font-family: "Courier New";
            position: fixed;
            top: 10px;
            left: 0;
            right: 20px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="header">
    <img src="{{ asset('img/gray-logo.png') }}" width="160" height="70" style="float: right" alt="">
    <p style="display: flex;margin-top: 40px; font-size: 12pt;font-weight: bold;align-items: center;justify-content: center">{{ $reportTitle ?? '' }}</p>
</div>
</body>
</html>

footer.blade.php

<!DOCTYPE html>
<html>

<head>
    <style>
        .footer {
            position: absolute;
            left: 0px;
            right: 0px;
            height: 10px;
            float: left;
            font-size: 7pt;
            border-top: 1px solid black;
            padding-top: 10px;
            font-family: 'Courier New';
        }

        .page-number {
            overflow: hidden;
            float: right;
            margin-right: 40px;
        }

        .report {
            overflow: hidden;
            width: 250px;
            float: left;
            margin-left: 10px;
        }
    </style>
</head>

<body>
<div class="footer">
    <div class="report">Page @pageNumber of @totalPages</div>
    <div class="page-number"><img src="{{public_path('img/broad-logo.png')}}" width="100" height="20"></div>
</div>
</body>
</html>

How to reproduce the bug

PDF budlider

return Pdf::view('reports.pdf.status_subject_wise', [
            'subjects' => $subjects
        ])->headerView('layout.reports.header', ['reportTitle' => 'Feed Back Status - Subject Wise'])
            ->footerView('layout.reports.footer')
            ->format('a4')
            ->orientation(Orientation::Landscape)
            ->margins(2.5, 0.5, 1.2, 0.5, 'cm')
            ->name('Feedback Status - Subject Wise.pdf');
  1. Image is not loading using asset() helper or public_path() there is no sign of image in the document. When use alt attribute it is not showing image not loaded
  2. when use asset() first page logo not showing (image not loaded it is not coming see the image) and if public path is use just a box appears

asset
Screenshot 2024-02-03 at 4 34 56 AM
public_path
Screenshot 2024-02-03 at 4 35 21 AM

need a solution for this isseues

Package Version

1.1.2

PHP Version

8.3.0

Laravel Version

10.40

Which operating systems does with happen with?

macOS

Notes

No use of #44 discussion

No response

@RVP04 RVP04 added the bug Something isn't working label Feb 3, 2024
@spatie spatie locked and limited conversation to collaborators Feb 3, 2024
@freekmurze freekmurze converted this issue into discussion #71 Feb 3, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant