# Printable Vietnamese Lunar Calendar (PDF/SVG) API

> Print-ready Vietnamese lunar calendars as PDF or SVG: wall, desk, 365-page block or one-page year, with holidays, can chi, good hours, logo and bleed.

- Endpoint: `POST | GET https://apibox.io.vn/v1/vn-calendar-print`
- Category: Files
- HTML docs: https://apibox.io.vn/docs/vn-calendar-print/ (Vietnamese: https://apibox.io.vn/vi/docs/vn-calendar-print/)
- Online tool: https://apibox.io.vn/tools/vn-calendar-print/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Generate a calendar for any `year` 2021–2199 in four `layout`s: `wall` (12 month pages), `desk` (12 landscape pages with an events column), `block` (one page per day: big solar day, weekday, lunar day and month length, can chi of year / month / day, hoàng đạo hours, solar term, holiday, quote) and `year` (one page). Lunar dates come from the Vietnamese calendar at UTC+7 (Hồ Ngọc Đức's algorithm used by `/v1/lunar-calendar`): Tết Đinh Mùi is 06/02/2027 and the 12th month of Bính Ngọ has 29 days. Days off come from `/v1/vn-holidays`, hoàng đạo / hắc đạo from `/v1/vn-good-days`.

Options: `size` (a2, a3, a4, a5, a6, 13x19, 19x27, 10x15, letter or `width_mm` + `height_mm`), `orientation`, `bleed_mm` (0–10, with crop marks and PDF TrimBox / BleedBox), theme `color`, `company` name, `logo` (PNG / JPEG), `company_holidays`, `quotes` (one per month or day), `week_start` (monday or sunday) and a month range. `format=pdf` (default, Be Vietnam Pro embedded), `svg` (one page: `page` or `date`) or `json` (the day data used for the layout).

A full 365-page block calendar renders in about a second. Colours are RGB; ask your printer to convert to CMYK.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `year` | body | number | no |  | Year 2021–2199 (default next year from July). |
| `layout` | body | string | no | `wall` | `wall`, `desk`, `block` or `year`. |
| `format` | body | string | no | `pdf` | `pdf`, `svg` (one page) or `json`. |
| `size` | body | string | no |  | a2, a3, a4, a5, a6, 13x19, 19x27, 10x15, letter (default by layout). |
| `orientation` | body | string | no |  | `portrait` or `landscape`. |
| `bleed_mm` | body | number | no | `0` | Bleed in mm (0–10); adds crop marks. |
| `color` | body | string | no | `#b3122e` | Theme colour (hex). |
| `company` | body | string | no |  | Company name printed on each page. |
| `logo` | body | file | no |  | Logo PNG / JPEG (multipart or `logo_base64`, ≤ 2 MB). |
| `company_holidays` | body | array | no |  | `[{ "date": "2027-02-11", "name": "Nghỉ bù" }]` (up to 100). |
| `quotes` | body | array | no |  | Quotes / greetings (up to 366, one per line accepted). |
| `week_start` | body | string | no | `monday` | `monday` or `sunday`. |
| `from_month` | body | number | no |  | First month to print (1–12). |
| `to_month` | body | number | no |  | Last month to print (1–12). |
| `page` | body | number | no |  | SVG: page number to return. |
| `date` | body | string | no |  | SVG block layout: the day to return. |
| `good_days` | body | boolean | no | `true` | Block layout: print hoàng đạo / hắc đạo and trực. |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/vn-calendar-print" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"year":2027,"format":"json","from_month":2,"to_month":2}'
```

## Example response

```json
{
  "year": 2027,
  "can_chi_year": "Đinh Mùi",
  "tet": "2027-02-06",
  "layout": "wall",
  "paper_mm": {
    "width": 297,
    "height": 420,
    "bleed": 0
  },
  "days": [
    {
      "date": "2027-02-05",
      "weekday_vi": "Thứ Sáu",
      "lunar": "29/12/2026",
      "lunar_month_length": 29,
      "can_chi": {
        "year": "Bính Ngọ",
        "month": "Tân Sửu",
        "day": "Ất Mão",
        "first_hour": "Bính Tý"
      },
      "solar_term": "Lập xuân",
      "lucky_hours": [
        "Tý",
        "Dần",
        "Mão",
        "Ngọ",
        "Mùi",
        "Dậu"
      ],
      "festival": "Giao thừa (Tất niên)",
      "day_off": "Tết Nguyên đán",
      "company": null,
      "observance": null,
      "red": true
    },
    {
      "date": "2027-02-06",
      "weekday_vi": "Thứ Bảy",
      "lunar": "01/01/2027",
      "lunar_month_length": 30,
      "can_chi": {
        "year": "Đinh Mùi",
        "month": "Nhâm Dần",
        "day": "Bính Thìn",
        "first_hour": "Mậu Tý"
      },
      "solar_term": "Lập xuân",
      "lucky_hours": [
        "Dần",
        "Thìn",
        "Tỵ",
        "Thân",
        "Dậu",
        "Hợi"
      ],
      "festival": "Tết Nguyên Đán",
      "day_off": "Tết Nguyên đán",
      "company": null,
      "observance": null,
      "red": true
    }
  ],
  "months": [
    {
      "month": 2,
      "lunar_span": "Âm lịch: tháng Chạp Bính Ngọ – tháng Giêng Đinh Mùi",
      "events": [
        "04/02 (28/12 ÂL): Tết Nguyên đán",
        "05/02 (29/12 ÂL): Giao thừa (Tất niên); Tết Nguyên đán",
        "06/02 (1/1 ÂL): Tết Nguyên đán; Mùng 1",
        "20/02 (15/1 ÂL): Tết Nguyên Tiêu (Rằm tháng Giêng); Rằm"
      ]
    }
  ]
}
```

## Use cases

- Print company Tết calendars with logo and company days off
- Automate calendar production for a print shop (n8n / API)
- Generate SVG pages for a designer to finish
- Feed a calendar app with correct Vietnamese lunar data

## FAQ

### Why not use a Chinese lunar calendar library?

Vietnam uses UTC+7, so some new moons fall on a different day than in China (UTC+8) and some months and even Tết can differ. This API computes the Vietnamese calendar.

### Can I add my own days off and quotes?

Yes: company_holidays as [{ "date", "name" }] are printed in red, and quotes are spread over the months (wall, desk) or days (block).

### Is the PDF ready for professional printing?

Set bleed_mm (usually 3) to get the bleed, crop marks and TrimBox / BleedBox. Colours are RGB; most print shops convert them to CMYK.
