Files
PDFcreator/AGENTS.md

71 lines
2.5 KiB
Markdown

# Repository Guidelines
## Project Structure & Module Organization
This is a small PHP Composer project for generating PDF files with `tecnickcom/tc-lib-pdf`.
- `src/` contains executable PDF scripts.
- `src/hello-world.php` is a minimal PDF example.
- `src/dotted.php` generates A4 dotted technical drawing paper.
- `output/` contains generated PDFs such as `output/dotted.pdf`; it is ignored by Git.
- `vendor/` contains Composer dependencies and generated font assets; it is ignored by Git.
- `README.md` documents setup and user-facing commands.
There is currently no dedicated `tests/` directory.
## Build, Test, and Development Commands
Install project dependencies:
```powershell
composer install
```
Generate font definitions required by `tc-lib-pdf-font`:
```powershell
cd vendor\tecnickcom\tc-lib-pdf-font\util
composer install
cd ..
composer install
cd util
php bulk_convert.php
```
Check PHP syntax:
```powershell
php -l src\hello-world.php
php -l src\dotted.php
```
Generate dotted paper from CLI:
```powershell
php src\dotted.php --dot-size=0.4 --space=5
```
Open via web server:
```text
http://localhost/pdfcreator/src/dotted.php?dot-size=0.4&space=5
```
## Coding Style & Naming Conventions
Use PHP 8 syntax and keep scripts under the `Igor\Pdfcreator` namespace. Prefer clear helper functions for parameter parsing, validation, and PDF drawing. Use four-space indentation, strict readable variable names like `$pageWidth`, `$tableBox`, and `$dotSize`, and kebab-case filenames for browser-facing scripts, for example `hello-world.php`.
Avoid writing generated files into tracked paths. Keep `vendor/` and `output/` uncommitted.
## Testing Guidelines
No automated test suite is configured yet. For changes, at minimum run `php -l` on modified PHP files and execute the affected script from CLI. For `src/dotted.php`, verify valid parameters generate `output/dotted.pdf` and invalid values such as `--dot-size=0` or `--space=1` fail with an error.
## Commit & Pull Request Guidelines
Git history was not available in this environment, so use concise imperative commit messages such as `Add dotted paper generator` or `Update font setup docs`. Pull requests should describe the change, list commands run, mention generated output paths, and include screenshots or PDFs when visual PDF layout changes.
## Security & Configuration Tips
Do not commit generated PDFs, Composer vendor files, or local configuration. Keep web scripts free of output before PDF headers. Validate all CLI and query parameters before using them in PDF generation.