[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Calendar: adjust margins for landscape PDF layout

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

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


Commits:
32c91c1a by Adrien Mbuya Maloba at 2026-08-20T19:20:54+03:00
[ENH] Calendar: adjust margins for landscape PDF layout
---
* [ENH] Calendar: adjust margins for landscape PDF layout

See merge request tikiwiki/tiki!11019

- - - - -


1 changed file:

- src/js/jquery-tiki/eventcalendar_to_pdf.js


Changes:

=====================================
src/js/jquery-tiki/eventcalendar_to_pdf.js
=====================================
@@ -30,24 +30,26 @@ $.fn.addEventCalendarPrint = function (buttonId, calendar) {
                     .text()
                     .trim();
                 var imgData = canvas.toDataURL("image/jpeg", 1.0);
-                var imgWidth = 180;
-                var pageHeight = 250;
-                var imgHeight = (canvas.height * imgWidth) / canvas.width;
-                var heightLeft = imgHeight;
                 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(isLandscapeFitToWidth ? "l" : "p", "mm");
                 doc.setFontSize(14);
                 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" || jqueryTiki.calendar_pdf_export_layout === "landscape_fit_to_width") {
-                    var marginTop = 30;
-                    var marginRight = 20;
-                    var marginBottom = 10;
                     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/32c91c1ad49dd168949971be9bbdf7f30baf3785

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