[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][ENH] Calendar: add landscape layout option for calendar PDF export

"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a870ef5aae91_3818cb441172d@gitlab-sidekiq-low-urgency-cpu-bound-v2-76457594dd-q72tt.mail>

Adrien Mbuya Maloba pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
958f6058 by Adrien Mbuya Maloba at 2026-08-20T17:20:08+03:00
[BP][ENH] Calendar: add landscape layout option for calendar PDF export
---
* [BP][ENH] Calendar: add landscape layout option for calendar PDF export
---
* [ENH] Calendar: add landscape layout option for calendar PDF export
---
* [ENH] Calendar: add landscape layout option for calendar PDF export

See merge request tikiwiki/tiki!10993

See merge request tikiwiki/tiki!10998

See merge request tikiwiki/tiki!10999

- - - - -


2 changed files:

- lib/prefs/calendar.php
- src/js/jquery-tiki/fullcalendar_to_pdf.js


Changes:

=====================================
lib/prefs/calendar.php
=====================================
@@ -189,6 +189,7 @@ function prefs_calendar_list()
             'type' => 'list',
             'options' => [
                 'fit_to_width' => tr('Fit to width'),
+                'landscape_fit_to_width' => tr('Landscape and fit to width'),
                 'fit_on_one_page' => tr('Fit on one page'),
             ],
             'default' => 'fit_on_one_page',


=====================================
src/js/jquery-tiki/fullcalendar_to_pdf.js
=====================================
@@ -33,17 +33,20 @@ $.fn.addEventCalendarPrint = function (buttonId, calendar) {
                 var pageHeight = 250;
                 var imgHeight = (canvas.height * imgWidth) / canvas.width;
                 var heightLeft = imgHeight;
-                var doc = new jsPDF("p", "mm");
+                const isLandscapeFitToWidth = jqueryTiki.calendar_pdf_export_layout === "landscape_fit_to_width";
+
+                const pageWidthMm = isLandscapeFitToWidth ? 297 : 210;
+                const pageHeightMm = isLandscapeFitToWidth ? 210 : 297;
+
+                var doc = new jsPDF(isLandscapeFitToWidth ? "l" : "p", "mm");
                 doc.setFontSize(14);
-                const pageWidthMm = 210;
                 doc.text((pageWidthMm - imgWidth) / 2, 20, calendarTitle.replace(/\s+/g, " "));
 
                 // Fit calendar to width (multi-pages)
-                if (jqueryTiki.calendar_pdf_export_layout === "fit_to_width") {
+                if (jqueryTiki.calendar_pdf_export_layout === "fit_to_width" || jqueryTiki.calendar_pdf_export_layout === "landscape_fit_to_width") {
                     var marginTop = 30;
                     var marginRight = 20;
                     var marginBottom = 10;
-                    const pageHeightMm = 297;
                     const printableHeight = pageHeightMm - marginTop - marginBottom;
                     const pxPerMm = canvas.width / imgWidth; // Scale factor to convert canvas coordinates (px) into PDF units (mm)
                     const pageHeightPx = printableHeight * pxPerMm;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/958f60587e613912264213955f7cae3a59e3e06c

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/958f60587e613912264213955f7cae3a59e3e06c
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.