https://github.com/a-schild/pdfcalendarbuilder
PHP library to generate pdf with monthly calendars and autosizing
https://github.com/a-schild/pdfcalendarbuilder
calendar churchtools library month pdf php php81
Last synced: 3 months ago
JSON representation
PHP library to generate pdf with monthly calendars and autosizing
- Host: GitHub
- URL: https://github.com/a-schild/pdfcalendarbuilder
- Owner: a-schild
- License: apache-2.0
- Created: 2019-03-27T22:19:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-12T15:50:54.000Z (about 2 years ago)
- Last Synced: 2025-03-23T22:23:57.708Z (3 months ago)
- Topics: calendar, churchtools, library, month, pdf, php, php81
- Language: PHP
- Homepage:
- Size: 291 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PDFCalendarBuilder
Generate pdf month calendars with autoscaling/sizingWith the addMonth() introduced in 1.0.8 you can generate a PDF containing
multiple months. Each month will be on it's own page then.## Unique features
- The class can try to put everything on one page
- In an normal calendar, all rows have the same height
- This library can shrink/expand rows, so everything fits on one page.
See setResizeRowHeightsIfNeeded(true/false);- If this is not enough, it can reduce the font size until everything fits on one page.
See setShrinkFontSizeIfNeeded(true/false);## Usage:
In your composer.json add the dependency:```
"require": {
"php": "^8.1",
"a-schild/pdfcalendarbuilder": ">=1.0.11",
}
```
### Creating the class and generate calendar
```
$cal = new aschild\PDFCalendarBuilder\CalendarBuilder(1, 2019, "Calendar title", true, 'mm', 'A4');
$cal->startPDF();
$cal->addEntry($startDate, $endDate, "Entry 1", "#000000", "#fffff");
$cal->buildCalendar();
$cal->Output("calendar.pdf", "I");
```### Creating the class and generate calendar for 3 months (Required version 1.0.7 or higher)
```
$cal = new aschild\PDFCalendarBuilder\CalendarBuilder(1, 2019, "Calendar title Jan", true, 'mm', 'A4');
$cal->startPDF();
$cal->addEntry($startDate1, $endDate1, "Entry 1", "#000000", "#ffffff");
$cal->buildCalendar();
$cal->addMonth(2, 2019, "Title for Feb");
$cal->addEntry($startDate2, $endDate2, "Entry 1", "#000000", "#ffffff");
$cal->buildCalendar();
$cal->addMonth(3, 2019, "Title for March");
$cal->addEntry($startDate3, $endDate3, "Entry 1", "#000000", "#ffffff");
$cal->buildCalendar();
$cal->Output("calendar.pdf", "I");
```## Examples
- Empty calendar, no entries, just a month grid

- Overflowing boxes in normal libraries

- Resize row heights to adapt space usage

- Resize row heights and shrink font size if needed

- Day spanning events
(C) 2019 A.Schild