@nexus-cortex/server 4.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.cortex/agents/AGENT_PROFILE_GUIDE.md +307 -0
  2. package/.cortex/agents/README.md +268 -0
  3. package/.cortex/agents/a-frontend-landing-page-designer.md +41 -0
  4. package/.cortex/agents/autoresearch-agent.md +49 -0
  5. package/.cortex/agents/code-reviewer.md +63 -0
  6. package/.cortex/agents/context-research.md +26 -0
  7. package/.cortex/agents/doc-writer.md +92 -0
  8. package/.cortex/agents/explore.md +63 -0
  9. package/.cortex/agents/new-model-api-integrator-analyst.md +41 -0
  10. package/.cortex/agents/plan.md +109 -0
  11. package/.cortex/agents/pr-architecture-reviewer.md +77 -0
  12. package/.cortex/agents/pr-code-quality.md +78 -0
  13. package/.cortex/agents/pr-implementer.md +50 -0
  14. package/.cortex/agents/pr-security-auditor.md +62 -0
  15. package/.cortex/agents/pr-test-writer.md +67 -0
  16. package/.cortex/agents/refactor.md +118 -0
  17. package/.cortex/agents/test-writer.md +72 -0
  18. package/.cortex/agents/web-researcher.md +72 -0
  19. package/.cortex/bench/tasks/sample-tasks.json +20 -0
  20. package/.cortex/commands/compare.md +14 -0
  21. package/.cortex/commands/deps.md +16 -0
  22. package/.cortex/commands/diff.md +14 -0
  23. package/.cortex/commands/explain.md +16 -0
  24. package/.cortex/commands/find-bug.md +13 -0
  25. package/.cortex/commands/profile.md +15 -0
  26. package/.cortex/commands/review.md +18 -0
  27. package/.cortex/commands/search.md +16 -0
  28. package/.cortex/commands/test.md +15 -0
  29. package/.cortex/permissions.dev.json +20 -0
  30. package/.cortex/permissions.example.json +71 -0
  31. package/.cortex/permissions.prod.json +63 -0
  32. package/.cortex/permissions.test.json +19 -0
  33. package/.cortex/skills/autoresearch/SKILL.md +77 -0
  34. package/.cortex/skills/autoresearch/personas/README.md +45 -0
  35. package/.cortex/skills/autoresearch/personas/aggressive-refactor.md +25 -0
  36. package/.cortex/skills/autoresearch/personas/creative.md +29 -0
  37. package/.cortex/skills/autoresearch/personas/perf-hunter.md +27 -0
  38. package/.cortex/skills/autoresearch/personas/precise.md +23 -0
  39. package/.cortex/skills/autoresearch/personas/root-cause.md +26 -0
  40. package/.cortex/skills/autoresearch/personas/security-auditor.md +29 -0
  41. package/.cortex/skills/autoresearch/personas/skeptic-reviewer.md +31 -0
  42. package/.cortex/skills/autoresearch/personas/test-first.md +25 -0
  43. package/.cortex/skills/best-of-n/SKILL.md +76 -0
  44. package/.cortex/skills/cortex/SKILL.md +834 -0
  45. package/.cortex/skills/cortex-bench/SKILL.md +354 -0
  46. package/.cortex/skills/docx/SKILL.md +83 -0
  47. package/.cortex/skills/pdf-documents/SKILL.md +297 -0
  48. package/.cortex/skills/pdf-documents/sections/01-image-acquisition.md +132 -0
  49. package/.cortex/skills/pdf-documents/sections/02-ai-image-generation.md +274 -0
  50. package/.cortex/skills/pdf-documents/sections/03-paper-sizes.md +89 -0
  51. package/.cortex/skills/pdf-documents/sections/04-design-system.md +549 -0
  52. package/.cortex/skills/pdf-documents/sections/05-css-print-rules.md +135 -0
  53. package/.cortex/skills/pdf-documents/sections/06-svg-charts.md +100 -0
  54. package/.cortex/skills/pdf-documents/sections/07-templates.md +224 -0
  55. package/.cortex/skills/pdf-documents/sections/08-scaled-output.md +164 -0
  56. package/.cortex/skills/pdf-documents/sections/09-preview-qa.md +66 -0
  57. package/.cortex/skills/pdf-documents/sections/10-reading-pdfs.md +499 -0
  58. package/.cortex/skills/pdf-documents/sections/11-form-filling.md +241 -0
  59. package/.cortex/skills/pptx/SKILL.md +90 -0
  60. package/.cortex/skills/resume-analyst/SKILL.md +373 -0
  61. package/.cortex/skills/verify-work/SKILL.md +74 -0
  62. package/.cortex/skills/xlsx/SKILL.md +101 -0
  63. package/.cortex/system-messages/messages/WORK_QUALITY.md +159 -0
  64. package/.cortex/system-messages/registry.json +18 -0
  65. package/LICENSE +202 -0
  66. package/NOTICE +2 -0
  67. package/README.md +13 -0
  68. package/bin/cortex-daemon.js +47 -0
  69. package/bin/cortex-server.js +15 -0
  70. package/dist/index.d.ts +30 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +513 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/middleware/cors.d.ts +10 -0
  75. package/dist/middleware/cors.d.ts.map +1 -0
  76. package/dist/middleware/cors.js +11 -0
  77. package/dist/middleware/cors.js.map +1 -0
  78. package/dist/middleware/errorHandler.d.ts +10 -0
  79. package/dist/middleware/errorHandler.d.ts.map +1 -0
  80. package/dist/middleware/errorHandler.js +15 -0
  81. package/dist/middleware/errorHandler.js.map +1 -0
  82. package/dist/routes/approval.d.ts +2 -0
  83. package/dist/routes/approval.d.ts.map +1 -0
  84. package/dist/routes/approval.js +96 -0
  85. package/dist/routes/approval.js.map +1 -0
  86. package/dist/routes/config.d.ts +2 -0
  87. package/dist/routes/config.d.ts.map +1 -0
  88. package/dist/routes/config.js +70 -0
  89. package/dist/routes/config.js.map +1 -0
  90. package/dist/routes/health.d.ts +2 -0
  91. package/dist/routes/health.d.ts.map +1 -0
  92. package/dist/routes/health.js +1031 -0
  93. package/dist/routes/health.js.map +1 -0
  94. package/dist/routes/mcp.d.ts +2 -0
  95. package/dist/routes/mcp.d.ts.map +1 -0
  96. package/dist/routes/mcp.js +251 -0
  97. package/dist/routes/mcp.js.map +1 -0
  98. package/dist/routes/messages.d.ts +5 -0
  99. package/dist/routes/messages.d.ts.map +1 -0
  100. package/dist/routes/messages.js +136 -0
  101. package/dist/routes/messages.js.map +1 -0
  102. package/dist/routes/middleware.d.ts +2 -0
  103. package/dist/routes/middleware.d.ts.map +1 -0
  104. package/dist/routes/middleware.js +146 -0
  105. package/dist/routes/middleware.js.map +1 -0
  106. package/dist/routes/models.d.ts +2 -0
  107. package/dist/routes/models.d.ts.map +1 -0
  108. package/dist/routes/models.js +29 -0
  109. package/dist/routes/models.js.map +1 -0
  110. package/dist/routes/permissions.d.ts +2 -0
  111. package/dist/routes/permissions.d.ts.map +1 -0
  112. package/dist/routes/permissions.js +253 -0
  113. package/dist/routes/permissions.js.map +1 -0
  114. package/dist/routes/pr.d.ts +2 -0
  115. package/dist/routes/pr.d.ts.map +1 -0
  116. package/dist/routes/pr.js +222 -0
  117. package/dist/routes/pr.js.map +1 -0
  118. package/dist/routes/sessions.d.ts +2 -0
  119. package/dist/routes/sessions.d.ts.map +1 -0
  120. package/dist/routes/sessions.js +628 -0
  121. package/dist/routes/sessions.js.map +1 -0
  122. package/dist/routes/system-messages.d.ts +2 -0
  123. package/dist/routes/system-messages.d.ts.map +1 -0
  124. package/dist/routes/system-messages.js +146 -0
  125. package/dist/routes/system-messages.js.map +1 -0
  126. package/dist/routes/tools.d.ts +2 -0
  127. package/dist/routes/tools.d.ts.map +1 -0
  128. package/dist/routes/tools.js +79 -0
  129. package/dist/routes/tools.js.map +1 -0
  130. package/package.json +63 -0
@@ -0,0 +1,274 @@
1
+ # AI-Generated Images for Documents
2
+
3
+ When real photographs aren't available, or you need custom illustrations, diagrams, hero images, or stylised graphics — generate them via AI image APIs.
4
+
5
+ Use cases:
6
+ - Cover art / hero images for reports
7
+ - Conceptual illustrations (historical scenes, architectural visualisations)
8
+ - Custom icons, diagrams, or infographics
9
+ - Placeholder images for draft documents
10
+ - Stylised section dividers
11
+
12
+ ## Provider Quick Reference
13
+
14
+ | Provider | Model | Cost | Quality | Speed | Best For |
15
+ |----------|-------|------|---------|-------|----------|
16
+ | **Cloudflare Workers AI** | FLUX.1 [schnell] | **Free tier** (~10K/day) | Good | Fast (~2s) | Quick illustrations, drafts |
17
+ | **Cloudflare Workers AI** | FLUX.2 [dev] | Free tier | Very good | Medium (~8s) | Production images, multi-ref |
18
+ | **xAI Imagine** | grok-imagine-image-quality | ~$0.07/image | Excellent | Medium | Hero images, photorealistic |
19
+ | **OpenAI** | gpt-image-2 | $0.02-0.19/image | Excellent | Medium | Text-in-image, precise control |
20
+ | **HuggingFace Inference** | FLUX.1 [schnell] / SDXL | Free (rate-limited) | Good | Variable | Open-source, customisable |
21
+
22
+ ## Cloudflare Workers AI (FREE — Recommended Default)
23
+
24
+ No API key purchase needed — uses your existing Cloudflare account (free tier: ~10,000 neurons/day).
25
+
26
+ ```bash
27
+ # ── FLUX.1 [schnell] — fastest, good quality ──────────────
28
+ curl -s -X POST \
29
+ "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/ai/run/@cf/black-forest-labs/flux-1-schnell" \
30
+ -H "Authorization: Bearer ${CF_API_TOKEN}" \
31
+ -H "Content-Type: application/json" \
32
+ -d '{"prompt": "Underwater photograph of ancient Chinese porcelain jars on the ocean floor, covered in coral and marine growth, dramatic blue lighting, photorealistic"}' \
33
+ --output generated-image.png
34
+
35
+ # ── FLUX.2 [dev] — higher quality, multi-reference ────────
36
+ curl -s -X POST \
37
+ "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/ai/run/@cf/black-forest-labs/flux-2-dev" \
38
+ -H "Authorization: Bearer ${CF_API_TOKEN}" \
39
+ -H "Content-Type: multipart/form-data" \
40
+ -F "prompt=Maritime museum interior with ancient artifacts, display cases with Chinese pottery, dramatic museum lighting" \
41
+ -F "steps=25" \
42
+ -F "width=1024" \
43
+ -F "height=768" \
44
+ --output generated-image.png
45
+
46
+ # Available models (image generation):
47
+ # @cf/black-forest-labs/flux-1-schnell — fast, 1-4 steps
48
+ # @cf/black-forest-labs/flux-2-dev — quality, multi-reference
49
+ # @cf/black-forest-labs/flux-2-klein-9b — balanced
50
+ # @cf/bytedance/stable-diffusion-xl-lightning — fast SDXL
51
+ # @cf/stabilityai/stable-diffusion-xl-base-1.0 — classic SDXL
52
+ # @cf/lykon/dreamshaper-8-lcm — stylised/artistic
53
+
54
+ # Response: raw PNG binary (pipe to file or base64)
55
+ curl -s -X POST ... | base64 -w0 > generated-image.b64
56
+ ```
57
+
58
+ **FLUX parameters:**
59
+ - `prompt` — description of the image
60
+ - `steps` — inference steps (1-50; schnell: 4 optimal, dev: 20-30)
61
+ - `width` / `height` — pixel dimensions (256-1920, default 1024x768)
62
+ - `guidance` — guidance scale (dev only, default 7.5; higher = more prompt adherence)
63
+ - `seed` — reproducible generation (positive integer)
64
+
65
+ ## xAI Imagine (Highest Quality — Uses Existing XAI_API_KEY)
66
+
67
+ ```bash
68
+ curl -s -X POST "https://api.x.ai/v1/images/generations" \
69
+ -H "Content-Type: application/json" \
70
+ -H "Authorization: Bearer ${XAI_API_KEY}" \
71
+ -d '{
72
+ "model": "grok-imagine-image-quality",
73
+ "prompt": "A weathered Australian diver standing in front of a maritime museum entrance, golden hour lighting, Subic Bay Philippines",
74
+ "n": 1,
75
+ "aspect_ratio": "16:9",
76
+ "resolution": "2k",
77
+ "response_format": "b64_json"
78
+ }' | jq -r '.data[0].b64_json' > hero-image.b64
79
+ ```
80
+
81
+ **Parameters:**
82
+ - `model` — `grok-imagine-image-quality` (recommended)
83
+ - `n` — batch count (1-4; same prompt, different generations)
84
+ - `aspect_ratio` — `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`, `2:1`, `1:2`, `auto`
85
+ - `resolution` — `1k` or `2k`
86
+ - `response_format` — `url` (temporary, download promptly) or `b64_json` (inline)
87
+
88
+ ## OpenAI GPT Image (Text-in-Image — Uses Existing OPENAI_API_KEY)
89
+
90
+ ```bash
91
+ curl -s -X POST "https://api.openai.com/v1/images/generations" \
92
+ -H "Content-Type: application/json" \
93
+ -H "Authorization: Bearer ${OPENAI_API_KEY}" \
94
+ -d '{
95
+ "model": "gpt-image-2",
96
+ "prompt": "A detailed architectural cross-section diagram of a Spanish galleon ship, labelled parts, technical illustration style, white background",
97
+ "n": 1,
98
+ "size": "1024x1024",
99
+ "response_format": "b64_json"
100
+ }' | jq -r '.data[0].b64_json' > diagram.b64
101
+
102
+ # Sizes: 1024x1024, 1024x1792, 1792x1024
103
+ ```
104
+
105
+ ## HuggingFace Inference API (Free Tier — Open Source Models)
106
+
107
+ ```bash
108
+ curl -s -X POST \
109
+ "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell" \
110
+ -H "Authorization: Bearer ${HUGGINGFACE_API_KEY}" \
111
+ -H "Content-Type: application/json" \
112
+ -d '{"inputs": "Underwater shipwreck scene, coral-covered hull, tropical fish, sunlight rays through water, photorealistic"}' \
113
+ --output generated-image.png
114
+
115
+ # Free tier: ~1000 requests/day with rate limiting
116
+ # May return 503 if model is loading — retry after 20s
117
+ ```
118
+
119
+ ## Provider Selection Decision Tree
120
+
121
+ ```
122
+ Need it FREE and fast?
123
+ → Cloudflare FLUX.1 [schnell] (no cost, ~2s, good quality)
124
+
125
+ Need photorealistic quality?
126
+ → xAI grok-imagine-image-quality (best realism, ~$0.07/image)
127
+
128
+ Need accurate text rendered IN the image?
129
+ → OpenAI gpt-image-2 (best at text-in-image rendering)
130
+
131
+ Need artistic / stylised?
132
+ → Cloudflare DreamShaper or SDXL Lightning
133
+
134
+ Need reproducible results (seed control)?
135
+ → Cloudflare FLUX (explicit seed parameter)
136
+
137
+ Need to stay fully open-source?
138
+ → HuggingFace FLUX.1 or SDXL
139
+ ```
140
+
141
+ ## Integration into HTML Document Pipeline
142
+
143
+ ```bash
144
+ #!/bin/bash
145
+ # Full pipeline: generate AI images → base64 → embed in HTML → PDF
146
+
147
+ # 1. Generate hero image
148
+ curl -s -X POST \
149
+ "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/ai/run/@cf/black-forest-labs/flux-1-schnell" \
150
+ -H "Authorization: Bearer ${CF_API_TOKEN}" \
151
+ -d '{"prompt": "Maritime museum at sunset, warm golden lighting"}' \
152
+ --output hero.png
153
+
154
+ # 2. Generate section illustration
155
+ curl -s -X POST "https://api.x.ai/v1/images/generations" \
156
+ -H "Content-Type: application/json" \
157
+ -H "Authorization: Bearer ${XAI_API_KEY}" \
158
+ -d '{"model":"grok-imagine-image-quality","prompt":"Ming Dynasty blue and white porcelain collection","n":1,"response_format":"b64_json"}' \
159
+ | jq -r '.data[0].b64_json' > porcelain.b64
160
+
161
+ # 3. Base64-encode the PNG (Cloudflare returns raw binary)
162
+ HERO_B64=$(base64 -w0 hero.png)
163
+
164
+ # 4. Inject into HTML (sed or template substitution)
165
+ sed -i "s|HERO_IMAGE_PLACEHOLDER|data:image/png;base64,${HERO_B64}|" document.html
166
+ sed -i "s|PORCELAIN_IMAGE_PLACEHOLDER|data:image/png;base64,$(cat porcelain.b64)|" document.html
167
+
168
+ # 5. Convert to PDF
169
+ chromium --headless --no-sandbox --disable-gpu \
170
+ --print-to-pdf=output.pdf --print-to-pdf-no-header \
171
+ document.html
172
+ ```
173
+
174
+ ## Reference-Grounded Image Generation (img2img)
175
+
176
+ For generative works — historical reconstructions, architectural visualisations, artistic interpretations — **don't generate from text alone.** Use reference images scraped during research as grounding inputs to img2img models.
177
+
178
+ **The workflow:**
179
+ ```
180
+ 1. Research: browse/scrape reference images (photos, paintings, maps, etc.)
181
+ 2. Describe: use a vision model to describe the reference in structured detail
182
+ 3. Generate: feed reference image + structured prompt to img2img model
183
+ 4. Series: reuse the same reference(s) across multiple generations for visual consistency
184
+ ```
185
+
186
+ **Step 1 — Collect Reference Images**
187
+ ```bash
188
+ # While browsing with nexus-browser:
189
+ browse({ url: "https://example.com/museum-gallery" })
190
+ scan({ filter: { tagName: "img" } })
191
+ screenshot({ selector: ".gallery-image:nth-child(3)" })
192
+
193
+ # Or download directly:
194
+ curl -L -o reference-01.jpg "https://direct-image-url.com/photo.jpg"
195
+ ```
196
+
197
+ **Step 2 — Describe via Vision Model**
198
+ ```bash
199
+ curl -s -X POST "https://api.x.ai/v1/chat/completions" \
200
+ -H "Content-Type: application/json" \
201
+ -H "Authorization: Bearer ${XAI_API_KEY}" \
202
+ -d '{
203
+ "model": "grok-4.3",
204
+ "messages": [{
205
+ "role": "user",
206
+ "content": [
207
+ {"type": "text", "text": "Describe this image in structured detail for use as an image generation reference. Include: subject, setting, lighting, color palette, style, composition, notable details."},
208
+ {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'"$(base64 -w0 reference-01.jpg)"'"}}
209
+ ]
210
+ }]
211
+ }' | jq -r '.choices[0].message.content'
212
+ ```
213
+
214
+ **Step 3 — Generate with Reference Grounding**
215
+ ```bash
216
+ # Cloudflare FLUX.2 [dev] — multi-reference grounding
217
+ curl -s -X POST \
218
+ "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/ai/run/@cf/black-forest-labs/flux-2-dev" \
219
+ -H "Authorization: Bearer ${CF_API_TOKEN}" \
220
+ -H "Content-Type: multipart/form-data" \
221
+ -F "prompt=A maritime museum entrance at golden hour, in the style of image 1, photorealistic" \
222
+ -F "input_image_0=@reference-01.jpg" \
223
+ -F "steps=30" \
224
+ -F "guidance=8.0" \
225
+ --output generated-grounded.png
226
+
227
+ # OpenAI gpt-image-2 — image editing with reference
228
+ curl -s -X POST "https://api.openai.com/v1/images/edits" \
229
+ -H "Authorization: Bearer ${OPENAI_API_KEY}" \
230
+ -F "model=gpt-image-2" \
231
+ -F "image=@reference-01.jpg" \
232
+ -F "prompt=Transform into artistic watercolor illustration, maintain architectural details" \
233
+ -F "size=1024x1024" \
234
+ --output generated-edit.png
235
+ ```
236
+
237
+ **Step 4 — Generate a Consistent Series**
238
+ ```bash
239
+ # Use the SAME reference for all generations → visually cohesive document
240
+ REFERENCE="reference-museum-exterior.jpg"
241
+ STYLE="in the photographic style of the reference, warm golden hour lighting"
242
+
243
+ curl ... -F "prompt=Wide establishing shot, ${STYLE}" -F "input_image_0=@${REFERENCE}" --output cover.png
244
+ curl ... -F "prompt=Museum interior with glass display cases, ${STYLE}" -F "input_image_0=@${REFERENCE}" --output interior.png
245
+ curl ... -F "prompt=Closeup of Ming Dynasty porcelain, ${STYLE}" -F "input_image_0=@${REFERENCE}" --output artifact.png
246
+ # All images share visual DNA from the reference → cohesive document
247
+ ```
248
+
249
+ **When to use grounded vs. text-only:**
250
+
251
+ | Scenario | Method | Why |
252
+ |----------|--------|-----|
253
+ | Historical reconstruction | Grounded (ref photos of real location) | Accuracy matters |
254
+ | Architectural visualisation | Grounded (ref photos + plans) | Spatial accuracy |
255
+ | Portrait / biographical | Grounded (real photos of the person) | Likeness |
256
+ | Abstract concept / metaphor | Text-only | No real-world reference exists |
257
+ | Decorative section divider | Text-only | Style matters, not accuracy |
258
+ | Scientific diagram | SVG (hand-authored) | Precision over aesthetics |
259
+
260
+ ## Prompt Engineering for Document Images
261
+
262
+ | Document Context | Prompt Suffix | Why |
263
+ |-----------------|---------------|-----|
264
+ | Cover/hero image | `dramatic lighting, professional photography, 16:9` | Eye-catching, full-width |
265
+ | Historical scene | `historical illustration style, muted earth tones, period-accurate` | Documentary tone |
266
+ | Technical diagram | `technical illustration, white background, labelled parts, clean lines` | Clarity |
267
+ | Portrait/bio | `portrait photograph, natural lighting, shallow depth of field` | Professional feel |
268
+ | Map/geography | `illustrated map style, vintage cartography, muted colors` | Readable, decorative |
269
+ | Section divider | `minimal decorative border, watercolor style, transparent background` | Subtle |
270
+
271
+ **Size guidelines for print:**
272
+ - Cover/hero: 2048x1024 minimum (fills page width at 300 DPI)
273
+ - Inline photo: 1024x768 sufficient (half-page width)
274
+ - Thumbnail/icon: 512x512 sufficient
@@ -0,0 +1,89 @@
1
+ # Paper Sizes — Complete Reference
2
+
3
+ All dimensions in **mm (millimetres)** with **inches** and **CSS** equivalents.
4
+
5
+ ## ISO A Series (International Standard — EU, Asia, most of world)
6
+
7
+ | Size | mm (W x H) | inches (W x H) | CSS @page | Common Use |
8
+ |------|-------------|-----------------|-----------|------------|
9
+ | **A0** | 841 x 1189 | 33.11 x 46.81 | `size: 841mm 1189mm` | Technical drawings, posters |
10
+ | **A1** | 594 x 841 | 23.39 x 33.11 | `size: 594mm 841mm` | Architectural plans, flip charts |
11
+ | **A2** | 420 x 594 | 16.54 x 23.39 | `size: 420mm 594mm` | Posters, diagrams |
12
+ | **A3** | 297 x 420 | 11.69 x 16.54 | `size: 297mm 420mm` | Tabloid drawings, large charts |
13
+ | **A4** | 210 x 297 | 8.27 x 11.69 | `size: A4` | **Default document worldwide** |
14
+ | **A5** | 148 x 210 | 5.83 x 8.27 | `size: 148mm 210mm` | Booklets, notebooks |
15
+ | **A6** | 105 x 148 | 4.13 x 5.83 | `size: 105mm 148mm` | Postcards, pocket guides |
16
+
17
+ ## ISO B Series (Intermediate sizes — envelopes, posters)
18
+
19
+ | Size | mm (W x H) | inches (W x H) | Common Use |
20
+ |------|-------------|-----------------|------------|
21
+ | **B0** | 1000 x 1414 | 39.37 x 55.67 | Large posters |
22
+ | **B1** | 707 x 1000 | 27.83 x 39.37 | Posters |
23
+ | **B2** | 500 x 707 | 19.69 x 27.83 | Posters |
24
+ | **B3** | 353 x 500 | 13.90 x 19.69 | Large menus |
25
+ | **B4** | 250 x 353 | 9.84 x 13.90 | Newspapers, maps |
26
+ | **B5** | 176 x 250 | 6.93 x 9.84 | Books, magazines |
27
+
28
+ ## North American Sizes (US, Canada)
29
+
30
+ | Size | mm (W x H) | inches (W x H) | CSS @page | Common Use |
31
+ |------|-------------|-----------------|-----------|------------|
32
+ | **Letter** | 215.9 x 279.4 | 8.5 x 11 | `size: letter` | **Default US document** |
33
+ | **Legal** | 215.9 x 355.6 | 8.5 x 14 | `size: legal` | Legal documents, contracts |
34
+ | **Tabloid / Ledger** | 279.4 x 431.8 | 11 x 17 | `size: ledger` | Spreadsheets, newspapers |
35
+ | **Half Letter** | 139.7 x 215.9 | 5.5 x 8.5 | `size: 139.7mm 215.9mm` | Booklets, flyers |
36
+ | **Executive** | 184.2 x 266.7 | 7.25 x 10.5 | `size: 184.2mm 266.7mm` | Memos, shorter letters |
37
+ | **ANSI C** | 431.8 x 558.8 | 17 x 22 | `size: 431.8mm 558.8mm` | Engineering drawings |
38
+ | **ANSI D** | 558.8 x 863.6 | 22 x 34 | `size: 558.8mm 863.6mm` | Architectural plans |
39
+ | **ANSI E** | 863.6 x 1117.6 | 34 x 44 | `size: 863.6mm 1117.6mm` | Large-format engineering |
40
+
41
+ ## Japanese (JIS) Sizes
42
+
43
+ | Size | mm (W x H) | Common Use |
44
+ |------|-------------|------------|
45
+ | **JIS B4** | 257 x 364 | Newspapers, atlases |
46
+ | **JIS B5** | 182 x 257 | Books, magazines |
47
+ | **Shiroku-ban 4** | 264 x 379 | Magazines |
48
+ | **Kiku 4** | 227 x 306 | Magazines |
49
+
50
+ ## Orientation
51
+
52
+ ```css
53
+ /* Portrait (default — taller than wide) */
54
+ @page { size: A4 portrait; }
55
+
56
+ /* Landscape (wider than tall) */
57
+ @page { size: A4 landscape; }
58
+
59
+ /* Mixed orientation per named page */
60
+ @page wide-chart { size: A4 landscape; }
61
+ .landscape-page { page: wide-chart; }
62
+ ```
63
+
64
+ ## Chromium Paper Size Flags
65
+
66
+ Chromium `--paper-width` and `--paper-height` are in **inches**:
67
+
68
+ ```bash
69
+ # A4:
70
+ --paper-width=8.27 --paper-height=11.69
71
+
72
+ # Letter:
73
+ --paper-width=8.5 --paper-height=11
74
+
75
+ # A3:
76
+ --paper-width=11.69 --paper-height=16.54
77
+
78
+ # Legal:
79
+ --paper-width=8.5 --paper-height=14
80
+
81
+ # Tabloid/Ledger:
82
+ --paper-width=11 --paper-height=17
83
+
84
+ # ANSI D:
85
+ --paper-width=22 --paper-height=34
86
+
87
+ # Custom (300mm x 1500mm banner):
88
+ --paper-width=11.81 --paper-height=59.06
89
+ ```