Closed jb2cool closed 2 months ago
My book isn't large, 68 pages i think, just markdown text and some embedded images.
hmm,I'm not sure why it goes to this path in your case:
https://github.com/HollowMan6/mdbook-pdf/blob/main/src/main.rs#L49C10-L49C21
The destination is controlled by mdBook. We just receive that configuration and calculate the path here. Or maybe there's something wrong/exceptional with your system configuration. You might want to try the container https://github.com/HollowMan6/mdbook-pdf/tree/main?tab=readme-ov-file#run-with-docker and see how it goes. if it continues and you have the book open-sourced somewhere, I can try it out.
I've changed by build command from mdbook build ~/2024_scebook --dest-dir /var/www/html
to mdbook build ~/2024_scebook --dest-dir /var/www
(to hopefully remove the double-html) and now my error has changed, it's now saying:
ubuntu@core-018:~$ mdbook build ~/2024_scebook --dest-dir /var/www
2024-08-16 11:40:14 [INFO] (mdbook::book): Book building has started
2024-08-16 11:40:14 [INFO] (mdbook::book): Running the html backend
2024-08-16 11:40:14 [INFO] (mdbook::book): Running the pdf backend
2024-08-16 11:40:14 [INFO] (mdbook::renderer): Invoking the "pdf" renderer
2024-08-16 11:40:14 [ERROR] (mdbook::renderer): The command `mdbook-pdf` wasn't found, is the "pdf" backend installed? If you want to ignore this error when the "pdf" backend is not installed, set `optional = true` in the `[output.pdf]` section of the book.toml configuration file.
2024-08-16 11:40:14 [ERROR] (mdbook::utils): Error: Rendering failed
2024-08-16 11:40:14 [ERROR] (mdbook::utils): Caused By: Unable to start the backend
2024-08-16 11:40:14 [ERROR] (mdbook::utils): Caused By: No such file or directory (os error 2)
But mdbook-pdf is clearly installed, i even stripped out all Rust and installed that afresh.
But mdbook-pdf is clearly installed, i even stripped out all Rust and installed that afresh.
mdbook-pdf should be called by mdbook directly; if mdbook can't find mdbook-pdf, I'm then not clear what might go wrong, and it's out of mdbook-pdf's control, but it worked before, right? I don't think it goes wrong just because you changed the parameter of --dest-dir
About --dest-dir,
I didn't realize that we could specify this parameter previously, let me see if this causes any bugs, and I'll implement fixes when needed.
I checked, and it works well still with --dest-dir
Some checklist for you:
sudo
or anything similar when you run mdbook
? If so, have you get mdbook-pdf installed for your root user?/var/www
?Building the book for hosting is just fine this is a new thing for us to want to wrap that up as a PDF to make it more portable. Just seems weird to me that if the destination directory is one thing i get one error (where mdbook seemingly CAN find mdbook-pdf and if i set the destination directory to one level higher i get a different error about mdbook-pdf not being found.
Yes, ubuntu user has write access to /var/www, hosting the html files there works just fine.
Don't think i ever did a sudo for anything mdbook.
ubuntu@core-018:~$ which mdbook-pdf
/home/ubuntu/.cargo/bin/mdbook-pdf
ubuntu@core-018:~$ which mdbook
/home/ubuntu/.cargo/bin/mdbook
Hmm, if so, that's weird. I would say it should be an environment issue for that mdbook-pdf not found one, but it's not quite clear to me why it happens. For the ERR_FILE_NOT_FOUND one, maybe Chromium has some issue accessing /var/www/html directly. if you just want to get the pdf, and not put it under /var/www/pdf/output.pdf, then just let this fail and go to your current directly and build your book again with mdbook build
:
cd ~/2024_scebook
mdbook build
now i feel like an idiot, why did i not think of that.
Yes, i can absolutely build the book for hosting and the PDF for portable distribution separately, thanks.
I have an Ubuntu 20.04 server and I've installed mdbook and mdbook-pdf via cargo, i also think i needed a browser to be able to export to PDF so i installed chromium-browser via apt. This should pretty much be as simple and clean a build as can be done.
book.toml reads:
When i try to build the book i get:
Full trace (i think) attached. trace.log