Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pagedjs
pagedjs
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 161
    • Issues 161
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tools
  • pagedjspagedjs
  • Issues
  • #179

Closed
Open
Opened Mar 04, 2020 by Antonio Norman@antman3351
  • Report abuse
  • New issue
Report abuse New issue

page:last formatting last page

Hello, I have the need to change the margins and footer on the last page, just I don't know the total number of pages until the document is rendered.

Is there a selector ?

I managed to create the desired output with some JS, as it's the last page, I can append the footer and position it to the bottom with position:absolute; bottom:0; and then remove page.js's bottom margins but I'm not sure if it will create any side effects.

class RemoveBottomMarginLastPage extends Paged.Handler
{
    constructor( chunker, polisher, caller )
    {
        super( chunker, polisher, caller );
    }

    afterRendered( pages )
    {
        let lastPage = pages[pages.length - 1];
        let pageBox = lastPage.pagebox;

        pageBox.style.gridTemplateRows = "[header] var(--pagedjs-margin-top) [page] calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top)) [footer] 0";
    }

}

Paged.registerHandlers( RemoveBottomMarginLastPage );

Thanks, Antonio

Edited Mar 04, 2020 by Antonio Norman
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
1
Labels
Bug
Assign labels
  • View project labels
Reference: tools/pagedjs#179