Bookstack: [FEATURE] Header/Footer for PDF Export

Created on 31 Aug 2017  路  7Comments  路  Source: BookStackApp/BookStack

For Feature Requests

For PDF etc. Export it would be nice to set a global Header/Footer to identify where the file is from etc. Maybe also wih Dynamic Fields like Version / Date / Creator.

Feature Request

Most helpful comment

This would be ideal. Shame we can't currently add the logo or other bits and have the option to remove the 'last edited by' information. Page numbers and a possible optional front cover page would be good too.

All 7 comments

I would support this request. I was thinking about this the other day when I exported a book.

Our current Microsoft Word document template have this and it helps a lot to have this information on a PDF or printed document.

This would be ideal. Shame we can't currently add the logo or other bits and have the option to remove the 'last edited by' information. Page numbers and a possible optional front cover page would be good too.

Agree, good request.

I also support this feature.

The feature should have items such as:

  • page numbers
  • chapter title/number
  • book title
  • draft (when not finalised)
  • logo
  • date/time
  • author/editors/etc

is there any news on this topic?

Hey @ssddanbrown - I've pushed a branch ( https://github.com/injektion/BookStack/tree/exportheaders ) which might help with this... For exports, it'll display a page number in the footer and allow users to create a page to include as a header on every page.

Most of the juice is in partials/export-header-footer.blade.php which is now included in all the /views/[books|chapters|pages]/export.blade.php and checks for a couple .env variables

EXPORT_HEADER_PAGE_SLUG=header
EXPORT_SHOW_PAGE_NUMBERS=true

There's some extra CSS added to partials/export-styles.blade.php which sets up a counter for pages, and if the .env is true will drop it into a footer div

        .pagenum:before {
            content: counter(page);
        }

As for the header, I'm currently letting the user define a page as their header, and then in partials/export-header-footer.blade.php using the slug of that page to import a header....

@if(env("EXPORT_HEADER_PAGE_SLUG"))
<div class="header">
    @php
        $PAGE = new \BookStack\Entities\Page();
        $page = $PAGE::where("slug", "=", env("EXPORT_HEADER_PAGE_SLUG"))->first();
        $page->html = (new \BookStack\Entities\Managers\PageContent($page))->render();
    @endphp
    {!! $page->html !!}
</div>
@endif

It's working fine to allow the user to create their own headers, add some page numbering, and export, but I think there's probably a better flow to how to get the user to define the page to use as their header... Do you have any recommendations on where you'd like to see the header get defined, or do you think this will work for those who want it?

Hey @ssddanbrown - I've pushed a branch ( https://github.com/injektion/BookStack/tree/exportheaders ) which might help with this... For exports, it'll display a page number in the footer and allow users to create a page to include as a header on every page.

can i with this disable Footer informations in PDF? I don't want author etc. inside of Footer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Legoracers picture Legoracers  路  3Comments

tpetrauskas picture tpetrauskas  路  4Comments

hhk7734 picture hhk7734  路  3Comments

davidtessier picture davidtessier  路  3Comments

marcvef picture marcvef  路  3Comments