[TikiWiki-commits] [Git][tikiwiki/tiki][27.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 <6a8790f8d241_387925cf0674dc@gitlab-sidekiq-low-urgency-cpu-bound-v2-76457594dd-xjgns.mail>

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


Commits:
cf2ed333 by Adrien Mbuya Maloba at 2026-08-21T02:33:14+03:00
[BP][ENH] Calendar: add landscape layout option for calendar PDF export
---
* [BP][ENH] Calendar: adjust margins for landscape PDF layout
---
* [ENH] Calendar: adjust margins for landscape PDF layout
---
* [ENH] Calendar: adjust margins for landscape PDF layout
---
* [ENH] Calendar: adjust margins for landscape PDF layout

See merge request tikiwiki/tiki!11019

See merge request tikiwiki/tiki!11025

See merge request tikiwiki/tiki!11026

* [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

See merge request tikiwiki/tiki!11027

- - - - -


2 changed files:

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


Changes:

=====================================
lib/prefs/calendar.php
=====================================
@@ -197,6 +197,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
=====================================
@@ -27,21 +27,26 @@ $.fn.addFullCalendarPrint = function (buttonId, calendar) {
                     .text()
                     .trim();
                 var imgData = canvas.toDataURL("image/jpeg", 1.0);
-                var imgWidth = 180;
+                const isLandscapeFitToWidth = jqueryTiki.calendar_pdf_export_layout === "landscape_fit_to_width";
+                const pageWidthMm = isLandscapeFitToWidth ? 297 : 210;
+                const pageHeightMm = isLandscapeFitToWidth ? 210 : 297;
+
+                var imgWidth = isLandscapeFitToWidth ? 267 : 180;
+                var marginLeft = (pageWidthMm - imgWidth) / 2;
+                var marginTop = isLandscapeFitToWidth ? 25 : 30;
+                var marginRight = isLandscapeFitToWidth ? 25 : 20;
+                var marginBottom = 10;
+
                 var pageHeight = 250;
                 var imgHeight = (canvas.height * imgWidth) / canvas.width;
                 var heightLeft = imgHeight;
-                var doc = new jsPDF("p", "mm");
+
+                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") {
-                    var marginTop = 30;
-                    var marginRight = 20;
-                    var marginBottom = 10;
-                    const pageHeightMm = 297;
+                if (jqueryTiki.calendar_pdf_export_layout === "fit_to_width" || jqueryTiki.calendar_pdf_export_layout === "landscape_fit_to_width") {
                     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/cf2ed333a429dfda151c2c9c37cd38c027c63ff5

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