HollowMan6 / mdbook-pdf

A backend for mdBook written in Rust for generating PDF based on headless chrome and Chrome DevTools Protocol. (用 Rust 编写的 mdBook 后端,基于headless chrome和Chrome开发工具协议生成PDF)
https://crates.io/crates/mdbook-pdf
GNU General Public License v3.0
150 stars 18 forks source link

How to disable cookie on the footer? #10

Closed YuCao16 closed 1 year ago

YuCao16 commented 1 year ago

This message appears on every page , how can it be removed.

image

Thanks!

YuCao16 commented 1 year ago

I found there is a print.html in folder html, open it with chrome, click Ok, Got it and save as pdf solve my problem.

HollowMan6 commented 1 year ago

Hi! Thank you for reporting this. Although there's some way like you said to handle this, I think it would still need to get fixed by our software. I will reopen this issue and investigate that later.

HollowMan6 commented 1 year ago

This message appears on every page , how can it be removed. image

Thanks!

Hi @YuCao16 ! Would you please provide the book source code you use that have this issue for me to investigate, or at least your book.toml if it's not open-sourced. Because I can't find any Google analytics js link or code in a normal mdbook generated book, so practically the generated book shouldn't use any cookies. I think you must use some other third-party plugins in this case.

YuCao16 commented 1 year ago

Hi, Here is the repo and the book.toml as follow:

[book]
authors = ["Martin Geisler"]
language = "en"
multilingual = false
src = "src"
title = "Comprehensive Rust 🦀"

[rust]
edition = "2021"

[build]
extra-watch-dirs = ["po"]

[preprocessor.links]
renderers = ["html"]

[preprocessor.index]
renderers = ["html"]

[preprocessor.svgbob]
renderers = ["html"]
class = "bob"

# Enable this preprocessor to overlay a large red rectangle on the
# pages. This will show you an estimate of what the course
# participants can see during the presentation.
#
[preprocessor.aspect-ratio-helper]
command = "./aspect-ratio-helper.py"

[output.html]
curly-quotes = true
additional-js = ["ga4.js", "speaker-notes.js"]
additional-css = ["svgbob.css", "speaker-notes.css"]
site-url = "/comprehensive-rust/"
git-repository-url = "https://github.com/google/comprehensive-rust"
edit-url-template = "https://github.com/google/comprehensive-rust/edit/main/{path}"

[output.html.fold]
enable = false
level = 0

[output.html.playground]
editable = true

[output.html.redirect]
"structure.html" = "running-the-course/course-structure.html"
"unsafe/unsafe-functions.html" = "calling-unsafe-functions.html"

[output.pdf]
landscape = false
display-header-footer = false
print-background = false
theme = "light"
scale = 1.25
paper-width = 7.07
paper-height = 10
margin-top = 0.4
margin-bottom = 0.4
margin-left = 0.4
margin-right = 0.4
page-ranges = ""
ignore-invalid-page-ranges = false
header-template = "<h3 style='font-size:8px; margin-left: 48%' class='title'></h3>"
footer-template = "<p style='font-size:10px; margin-left: 48%'><span class='pageNumber'></span> / <span class='totalPages'></span></p>"
prefer-css-page-size = true

[output.pdf-outline]
like-wkhtmltopdf = true

Actually, with this book.toml, I'm not able to build the pdf-outline, it throw error: lxml.etree.ParserError: Document is empty (PDF generation is fine).

HollowMan6 commented 1 year ago

Actually, with this book.toml, I'm not able to build the pdf-outline, it throw error: lxml.etree.ParserError: Document is empty (PDF generation is fine).

Okay, will investigate that as well, thank you!

HollowMan6 commented 1 year ago

Hi! I have fix this cookie issue, but I can't reproduce the pdf-outline issue lxml.etree.ParserError: Document is empty you mentioned, so I don't know what caused your problem. You can check the CI for the generated outline version of the book: https://github.com/HollowMan6/mdbook-pdf/actions/runs/4135358169

Windows_Comprehensive_Rust_PDF.pdf Linux_Comprehensive_Rust_PDF.pdf macOS_Comprehensive_Rust_PDF.pdf