BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.39k stars 1.93k forks source link

Ability to manage pdf export zoom/page size #4185

Open eoli3n opened 1 year ago

eoli3n commented 1 year ago

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?

How long have you been using BookStack?

0 to 6 months

Additional context

No response

eoli3n commented 1 year ago

Nothing planned ?

ssddanbrown commented 1 year ago

@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.

eoli3n commented 1 year ago

A hack would be perfect if possible, with dompdf

ssddanbrown commented 1 year ago

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>
eoli3n commented 1 month ago

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

ssddanbrown commented 1 month ago

@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);
});