# Use and adapt pdf-ar

Use the documented interfaces and source layout for **pdf-ar**. The sections below retain the README’s examples and configuration details.

## Workspace

- `apps/builder`: Next.js SaaS app, dashboard, templates, projects, PDFMe studio editor, and Hono API routes.
- `packages/pdf-engine`: TypeScript Arabic/RTL PDF engine powered by `pdf-lib`.
- `apps/builder/src/components/pdf-studio`: full-screen PDF builder UI.
- `apps/builder/src/lib/pdfme`: PDFMe plugins, fonts, and template presets.
- `apps/builder/src/store`: Zustand editor state.

## Run

```bash
npm install
npm run dev
```

Open `http://localhost:3000`.

Useful routes:

- `/dashboard`
- `/templates`
- `/projects`
- `/projects/demo-villa/editor`
- `/api/health`

## PDF Studio

The editor route is a real WYSIWYG builder powered by `@pdfme/ui`:

- add text, image, rectangle, ellipse, line, and QR code elements
- move, resize, rotate, and edit elements directly on the PDF page
- manage multiple pages
- use custom left palette, right properties panel, and layers list
- import property JSON or PDFMe template JSON
- export with `@pdfme/generator`, using the same template as the canvas
- load the Cairo font through `/api/assets/fonts/cairo` for Arabic PDF output

## Commands in the root manifest

The captured [package.json](https://github.com/Up-to-code/pdf-ar/blob/HEAD/package.json) declares the following scripts. Run them from the directory containing that manifest.

| Command | Script |
| --- | --- |
| `npm run start` | `npm run start -w @pdf-ar/builder` |
| `npm run dev` | `npm run dev -w @pdf-ar/builder` |
| `npm run build` | `npm run build --workspaces --if-present` |
| `npm run test` | `tsx --test tests/**/*.test.ts` |
| `npm run typecheck` | `npm run typecheck --workspaces --if-present` |

## Troubleshoot a local change

1. Reproduce the smallest example from the [quick-start guide](/docs/up-to-code-pdf-ar/quick-start-guide).
2. Compare required configuration and dependency versions with the README.
3. Check the linked issue tracker for the same error. Include the command, runtime version, and relevant error when reporting a problem; omit credentials.

## Source and help

- [GitHub repository](https://github.com/Up-to-code/pdf-ar)
- [Original README](https://github.com/Up-to-code/pdf-ar/blob/main/README.md)
- [Issues and existing reports](https://github.com/Up-to-code/pdf-ar/issues)
