https://github.com/juliapluto/plutopdf.jl
Export Pluto notebooks to PDF from the command line
https://github.com/juliapluto/plutopdf.jl
exporting-pluto-notebooks julia pluto-notebooks
Last synced: 3 months ago
JSON representation
Export Pluto notebooks to PDF from the command line
- Host: GitHub
- URL: https://github.com/juliapluto/plutopdf.jl
- Owner: JuliaPluto
- License: mit
- Created: 2021-02-18T17:52:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T17:24:38.000Z (4 months ago)
- Last Synced: 2025-03-28T18:24:05.722Z (4 months ago)
- Topics: exporting-pluto-notebooks, julia, pluto-notebooks
- Language: Julia
- Homepage:
- Size: 122 KB
- Stars: 37
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# How to export Pluto notebooks to PDF?
You probably don't need the PlutoPDF.jl package! Just **open the notebook in Pluto** and **print out the page** (`⌘ P` or `Ctrl+P`). In the popup menu that opens, select the printer "Print to PDF". Be sure to enable "background graphics" and disable "headers and footers". **This is not a hack!** Pluto is designed to output high-quality PDF files using the browser print function.
In fact, this package PlutoPDF.jl works exactly the same: it uses [puppeteer](https://pptr.dev/) and the Chromium browser ("headless") to print the document for you (and the result will be the same). You can use PlutoPDF.jl when you need to generate PDF files automatically from a script, e.g. when you have many notebooks that you want to archive.
# Unmaintained
Unfortunately, PlutoPDF.jl takes too much work to maintain! So if it works on your computer, yay! Otherwise, sorry! PRs very welcome!
# PlutoPDF.jl
*Don't let your printer miss out on the fun!*
## Usage
From within Julia:
```julia
import PlutoPDF
PlutoPDF.pluto_to_pdf("notebook.jl")
```### Screenshots
You can also use PlutoPDF to take screenshots of all notebook cells!
```julia
import PlutoPDF
pdf_path = "notebook.pdf"
screenshots_dir = "notebook_screenshots"PlutoPDF.pluto_to_pdf("notebook.jl", pdf_path, screenshots_dir)
```# How it works
PlutoPDF.jl is just a combination of other software:
- Pluto: besides running notebooks, the Pluto editor is designed to look nice when printed. When you use Pluto's export to Static PDF button (top right in the editor), the button just tells the browser to open the Print window.
- Chromium web browser: Pluto has CSS styling specific for printing. But it is the browser that has the ability to take HTML and CSS and make a PDF from it.
- PlutoSliderServer: this package makes it easy to "convert `.jl` to `.html`." It can open a notebook, run it, and generate the export HTML all from the command line, so you don't need to click buttons in Pluto.
- hmmmm more info coming maybe or you can open an Issue with questions# Development
When developing, it's nice to have the `node_modules` folder locally. Navigate to the `node` directory and run `npm install`.
If you don't have `npm`, then run `julia --project` and then
```julia
import PlutoPDF
PlutoPDF.build_node(joinpath(pwd(), "node"))
```