[TikiWiki-commits] [Git][tikiwiki/tiki][30.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 <6a862a67d604f_3818cf2c2905a@gitlab-sidekiq-low-urgency-cpu-bound-v2-d6c7fcbb-jfqjz.mail>

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


Commits:
4d8e3446 by Adrien Mbuya Maloba at 2026-08-20T01:06:17+03:00
[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

- - - - -


2 changed files:

- lib/prefs/calendar.php
- src/js/jquery-tiki/eventcalendar_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/eventcalendar_to_pdf.js
=====================================
@@ -34,17 +34,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/4d8e344695b7d5da24cfb631c28adebb97df1451

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4d8e344695b7d5da24cfb631c28adebb97df1451
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.