BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Ability to manage pdf export zoom/page size

Open eoli3n opened this issue 2 years ago • 6 comments

Describe the feature you'd like

I want more information per pages when exporting as pdf/html, the default zoom is huge.

Describe the benefits this would bring to existing BookStack users

Less pages to print, less paper, less cutted tree, amazonia saved, more oxygen on the planet = more happiness :)

Can the goal of this request already be achieved via other means?

Kind of, yes : export as html, print a pdf with 70% zoom. But it change how it looks.

Have you searched for an existing open/closed issue?

  • [X] I have searched for existing issues and none cover my fundemental request

How long have you been using BookStack?

0 to 6 months

Additional context

No response

eoli3n avatar Apr 20 '23 08:04 eoli3n

Nothing planned ?

eoli3n avatar Sep 16 '23 06:09 eoli3n

@eoli3n Not right now, there's been no other demand for this, so not really something I'd look to add an option for.

I could probably provide logical theme system hack to alter this globally if desired, Just need to know if you're using the default PDF renderer or if you've set settings to use WKHTMLTOPDF.

ssddanbrown avatar Sep 16 '23 10:09 ssddanbrown

A hack would be perfect if possible, with dompdf

eoli3n avatar Sep 16 '23 17:09 eoli3n

Here's an unofficial hack, can't assure it'll be issue free. It's fairly simple though so should rarely cause issues with future changes (not impossible though). Add this to your functions.php after going the "Getting Started" part of the logical theme system docs/video.

<?php

use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;

Theme::listen(ThemeEvents::APP_BOOT, function () {
    config()->set('dompdf.options.dpi', 144);
});

Adjust the 144 as needed (default is 96). If things look a little "contained" (with large side margins), you can add the below to the "Custom HTML Head Content" customization setting within the BookStack UI:

<style>
.export-format-pdf .page-content { max-width: 100%; }
</style>

ssddanbrown avatar Sep 16 '23 17:09 ssddanbrown

Does this still work with recent pdf export changes ? IMO the default export size is WAY to big.

eoli3n avatar Sep 26 '24 07:09 eoli3n

@eoli3n I have not tested this, but the setting has moved for the current version of BookStack, and the functions.php should probably now be:

<?php

use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;

Theme::listen(ThemeEvents::APP_BOOT, function () {
    config()->set('exports.dompdf.dpi', 144);
});

ssddanbrown avatar Sep 26 '24 13:09 ssddanbrown