ASown's picture
Consolidate project history under ASown
f368481
|
Raw History Blame Contribute Delete
2.06 kB
# Paper printer demo — Brother MFC-L3750CDW
Agent that turns a request into an image and prints it on **A4 paper** via IPP
(no driver, no admin). Separate from the CNC/3D simulator in `../cnc_websim_demo`.
## Files
- `paper_print.py` — low-level IPP printing. `attrs` = query printer; `print_image(path)`.
- `paper_agent.py` — request → image (local / URL / generated) → print.
- `paper.ps1` — one-line wrapper (loads env from `note.txt`).
- `images/` — generated/downloaded pages.
- `note.txt` — env: `PAPER_PRINTER_HOST` (printer IP) + optional `GROQ_API_KEY`
(for VN→EN prompt translation when generating).
## Printer
Brother MFC-L3750CDW at `192.168.1.222` (IPP `http://.../ipp/print`).
Supported formats: image/jpeg, image/pwg-raster, image/urf (NOT pdf) → we send
a full-page A4 **JPEG**.
## Use
```powershell
cd paper_printer_demo
.\paper.ps1 attrs # printer status
.\paper.ps1 "in cho tôi hình con mèo" # generate a cat -> print
.\paper.ps1 "C:\path\photo.jpg" # print a local image
.\paper.ps1 "https://.../image.jpg" # download + print
```
## Size flags (image size on the A4 page)
Sizes are in **mm**. The image keeps its aspect ratio and fits INSIDE the box.
```powershell
.\paper.ps1 "con mèo" --size 80x120 # fit within 80 x 120 mm, centered
.\paper.ps1 "con mèo" --w 100 # width box 100 mm (height auto page)
.\paper.ps1 "con mèo" --h 150 # height box 150 mm
.\paper.ps1 "con mèo" --margin 25 # no size box: fit page minus 25 mm margin
.\paper.ps1 "con mèo" --size 90x90 --align top # place near top
.\paper.ps1 photo.jpg --size 100x150 --stretch # force exact 100x150 (may distort)
.\paper.ps1 "con mèo" --dpi 300 # higher print resolution
```
Other flags: `--align center|top|bottom`, `--stretch` (exact WxH, ignores aspect).
The run prints the actual placed size, e.g. `Đã gửi in (80x107mm)`.
## Change printer / IP
Edit `PAPER_PRINTER_HOST` in `note.txt`, or set `$env:PAPER_PRINTER_HOST`.