Skip to content

wkhtmltopdf generating wrong TOC links #80

Closed
@maggie44

Description

@maggie44

Expected Behavior

Links should point to the heading for that section as can be seen when done through the BookStack development environment.

Current Behavior

When exporting a page to pdf with wkhtmltopdf and opening it, clicking one of the TOC links, it doesn't take me to the correct location and shows a meaningless link address, like file:///tmp/knp_snappy5ff65ed5491ae7.13561238.html.

This behaviour cannot be reproduced on the official BookStack install or development environment, only the Linuxserver and Solidnerd images.

Steps to Reproduce

Steps to reproduce the behavior:

Create a page with some headers
Configure BookStack to use wkhtmltopdf for pdf-generating
Export and open
Click one of the TOC links

Process of elimination has narrowed this down to the version of wkhtmltopdf running:

Development environment: wkhtmltopdf 0.12.6 (with patched qt)
Linuxserver: wkhtmltopdf 0.12.5
Solidnerd: wkhtmltopdf 0.12.5

So I updated the Linuxserver image to the 0.12.6 (actually I bumped the Alpine container version to .13, which then pointed it to the new repository which had the 0.12.6 in it). But the issue still occurred.

Then I pulled the latest build directly from the website (https://wkhtmltopdf.org/downloads.html) into the Solidnerd container, and the issue was resolved.

The difference, is in 1. the wkhtmltopdf version became: wkhtmltopdf 0.12.6. In scenario 2. the version became: wkhtmltopdf 0.12.6 (with patched qt)

The solution then it appears, is to install wkhtmltopdf 0.12.6 (with patched qt. More can be read about qt here: https://wkhtmltopdf.org/downloads.html).

This should be relatively easy for the Solidnerd container as it can be pulled directly from the source.

For the Linuxserver though, which is Alpine Linux, there doesn't appear to be a version compatible with MUSL, so wasn't able to get the QT version installed.

Discussion over on BookStack that lead to here: BookStackApp/BookStack#2459 (comment)

A discussion on the wkhtmltopdf repo related to Alpine support: wkhtmltopdf/packaging#2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions