Closed syang closed 11 months ago
The error indicates that print.html
can't be found: https://github.com/HollowMan6/mdbook-pdf/blob/39bb46f497800c3231b0011996bbc8b6f90f0ee5/src/main.rs#L59-L63
Looking at your log, I can see that the html backend didn't get called before pdf renderer, a working one should look like this:
$ mdbook build
2023-11-18 17:33:47 [INFO] (mdbook::book): Book building has started
2023-11-18 17:33:47 [INFO] (mdbook::book): Running the html backend
2023-11-18 17:33:47 [INFO] (mdbook::book): Running the pdf backend
2023-11-18 17:33:47 [INFO] (mdbook::renderer): Invoking the "pdf" renderer
Generating PDF, please be patient...
PDF successfully generated at: ...
So I guess you may forgot to put [output.html]
before [output.pdf]
, or you set [output.html.print]
as disabled, and I have mentioned those things already in the README. Do remember to read through README before you continue: https://github.com/HollowMan6/mdbook-pdf?tab=readme-ov-file#installation--usage
Just remove the theme parameter here to use the default theme: https://github.com/HollowMan6/mdbook-pdf/blob/main/test_doc/book.toml#L24 Or replace it with any theme you want according to mdbook configuration
Thanks for the pointer. Two more questions about the output format (I am fine-tuning the output format now, thanks for the help making me here)
Thanks, definitely a great project for people who wanted to produce paper document!
My current configuration
landscape = false display-header-footer = true print-background = false # theme = "ayu" scale = 0.7 paper-width = 8 paper-height = 10 margin-top = 0.5 margin-bottom = 0.5 margin-left = 0.5 margin-right = 0.5 page-ranges = "" ignore-invalid-page-ranges = false prefer-css-page-size = true
All of your questions now relate to mdbook and is not directly controllable by mdbook-pdf. mdbook-pdf generates PDF via print.html, so you can of course customize those things via css/print.css
for printer output. https://rust-lang.github.io/mdBook/format/theme/index.html
Hi @HollowMan6 ,
I am trying to export a book into PDF format and found mdbook-pdf.
First, I cloned the project into ~/personal/mdbook-pdf
I compiled the source, I found the binary is in /Users/syang/personal/mdbook-pdf/target/debug/mdbook-pdf
I add the path into the PATH variable, export PATH="/Users/syang/personal/mdbook-pdf/target/debug:$PATH"
Now I start serving, and I got the following error message
➜ mdbook git:(main) ✗ mdbook serve
2023-11-18 08:12:05 [INFO] (mdbook::book): Book building has started 2023-11-18 08:12:05 [INFO] (mdbook::book): Running the pdf backend 2023-11-18 08:12:05 [INFO] (mdbook::renderer): Invoking the "pdf" renderer thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:63:10 note: run withRUST_BACKTRACE=1
environment variable to display a backtrace 2023-11-18 08:12:05 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code. 2023-11-18 08:12:05 [ERROR] (mdbook::utils): Error: Rendering failed 2023-11-18 08:12:05 [ERROR] (mdbook::utils): Caused By: The "pdf" renderer failedNote: if I took out the output.pdf instruction from the foo.book configuration file, then I can successfully create the book site.
Can you give some suggestion about how I can solve the problem? (I am using M2 Pro chip and Ventura 13.5 MacBook)
Thanks