Metadata-Version: 2.1
Name: graphpaper
Version: 0.1.0
Summary: Printable graph paper, dot grid, lined, isometric, hexagon and music staff paper as exact-size PDF or SVG. No dependencies.
Author: Anders Lee
License: MIT
Project-URL: Homepage, https://graphpaperpdf.net/
Keywords: graph paper,pdf,printable,dot grid,isometric,hex grid,music staff,handwriting paper,template
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Printing
Classifier: Topic :: Education
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Developers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# graphpaper

Make printable graph paper as PDF or SVG from Python or the command line: square grids, dot grids,
lined and handwriting paper, isometric and hexagon grids, and music staff / guitar tab paper.

- **Exact size.** Whole cells are fitted inside the margin and centred, so a 1/4 inch grid measures
  1/4 inch when printed at 100% ("Actual size", not "Fit to page").
- **Small files.** Pure vector output. Multi-page PDFs share one content stream, so a 100-page
  notebook is barely bigger than one page.
- **No dependencies.** Pure Python 3.8+.

```
pip install graphpaper
```

## Command line

```
graphpaper grid --spacing 0.25in --major 4 -o quarter-inch.pdf
graphpaper grid --spacing 5mm --size a4 --major 2 -o 5mm.pdf
graphpaper dot --spacing 5mm --size a4 --pages 50 -o dot-notebook.pdf
graphpaper lined --spacing 0.75in --midline --header --no-margin-line -o handwriting.pdf
graphpaper isometric --spacing 0.5in -o iso.svg
graphpaper hex --spacing 0.577in -o one-inch-hexes.pdf      # 1 in across the flats
graphpaper staff --spacing 2mm --staves 12 -o staff.pdf
graphpaper staff --spacing 2.5mm --staves 8 --tab -o guitar-tab.pdf
```

Run `graphpaper --help` for every option. The output format follows the file extension (`.pdf` or `.svg`).

## Python

```python
import graphpaper

graphpaper.save("quarter-inch.pdf", "grid", spacing="0.25in", major=4)
graphpaper.save("dots.pdf", "dot", spacing="5mm", size="a4", pages=50)

data = graphpaper.pdf("lined", spacing="0.28125in", header=True)   # bytes
svg = graphpaper.svg("isometric", spacing="0.5in", color="#999999")  # str

page = graphpaper.layout("grid", spacing="1cm", size="a4")
print(page.info)   # {'columns': 19, 'rows': 28}
```

Lengths are strings with a unit (`"5mm"`, `"0.25in"`, `"1cm"`, `"18pt"`) or plain numbers in inches.

| Kind | `spacing` means | Useful options |
|---|---|---|
| `grid` | square size | `major` (every Nth line bold), `border`, `header` |
| `dot` | distance between dots | `major` (bigger dot every Nth), `dot_size` |
| `lined` | line gap (college ruled = 9/32 in, wide = 11/32 in) | `midline`, `margin_line`, `header` |
| `isometric` | triangle side | `major`, `border` |
| `isodot` | triangle side | `dot_size` |
| `hex` | hexagon side (across the flats = side × √3) | |
| `staff` | gap between staff lines | `staves`, `staff_lines=6` (TAB), `grand` |

Common options: `size` (`letter`, `a4`, `legal`, `tabloid`, `a3`, `a5` or a `(width, height)` tuple),
`landscape`, `margin`, `color`, `major_color`, `weight`, `major_weight` (points).

## Notes

- Isometric lines all pass through one lattice point at the centre of the page, so the vertical lines
  meet the diagonals exactly on every page size.
- Hexagon edges shared by two cells are drawn once, which keeps lines even and files small.
- For e-ink tablets, set `size` to the screen size, e.g. reMarkable 2: `size=("6.212in", "8.283in")`.

This package is the Python counterpart of the browser generator at https://graphpaperpdf.net/,
which also has coordinate planes, polar, semi-log and log-log paper, Cornell notes and engineering pads.

## License

MIT
