Skip to content
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

PDF/Print Issue - Footer of last content page and additional blank page issue #30

Open
delize opened this issue Jan 18, 2025 · 0 comments

Comments

@delize
Copy link

delize commented Jan 18, 2025

First, I am super appreciative of this repo, and it is incredibly easy to use. However, I have noticed an additional issue when the CV pages are greater than 1.

Here is a public repo example based on the PDF: https://github.com/delize/almeida-cv-test-site

This is an example of when expanding the content.yaml has content that expands the page to be greater than one.
Default - Example - CV.pdf

Issue 1: Footer & Height

When using the stock information and template, and filling out more lorem ipsum text and changing the color styling there are two main issues that happen:

Image

The second page sidebar content or color theming, constantly does not meet the full page height.

Issue 2: Additional Blank Page on PDF

There is always an n+1 blank page (in this case, page three), even though the hugo.toml file is set to 2.

I have spent several hours trying to troubleshoot, play around, and debug with the following files:

  • _layout.scss
  • _section.scss
  • baseof.html

Adjusting things like:

footer {
    position: absolute; /* Let the footer align naturally */
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3rem; /* Fixed footer height */
    background-color: white;
    text-align: center;
    z-index: 10;
    padding: 1rem 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1); /* Optional shadow */
}

body {
    margin: 0;
    padding-bottom: 4rem; /* Matches footer height */
}

@media print {
    footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 3rem;
        background-color: white;
        text-align: center;
        z-index: 1000;
    }

    body {
        padding-bottom: 4rem;
    }
}

Or making a custom _print.scss with:

@media print {
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        margin: 0;
        padding: 0;
        padding-bottom: 4rem; /* Matches footer height */
    }

    footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 3rem;
        text-align: center;
        background-color: white;
        page-break-after: auto; /* Prevent footer from adding blank pages */
    }

    .section {
        page-break-inside: auto; /* Allow sections to break naturally */
        page-break-before: auto;
        page-break-after: auto;
        margin-bottom: 1.5rem;
    }

    .container {
        max-height: 95vh; /* Ensure content fits on the page */
        margin: 0 auto;
        padding: 0 1rem;
        overflow: hidden;
    }
}

However, I have not been able to resolve this. Something else appears to be causing this issue, and it isn't super obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant