[TikiWiki-commits] [Git][tikiwiki/tiki][master] [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 <6a862041121b7_387efe3c76752@gitlab-sidekiq-low-urgency-cpu-bound-v2-566847577d-fkdhj.mail>

Adrien Mbuya Maloba pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
a2118877 by Adrien Mbuya Maloba at 2026-08-20T00:12:23+03:00
[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

- - - - -


2 changed files:

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


Changes:

=====================================
lib/prefs/calendar.php
=====================================
@@ -224,6 +224,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/a21188773924c8a8f6b509ecd060de2e7510f811

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