Improve PDF schedule layout for better readability and alignment
Adjust PDF rendering to ensure all meeting details (number, title, attendees, time) are contained within a single row, improve vertical alignment to the top, and set correct text alignment for RTL content.
This commit is contained in:
@@ -815,7 +815,7 @@ export async function renderSchedulePdf(input: RenderPdfInput): Promise<Buffer>
|
||||
const headerWidths = isRtl ? [...colWidths].reverse() : colWidths;
|
||||
|
||||
const cellPadX = 4;
|
||||
const cellPadY = 0;
|
||||
const cellPadY = 2;
|
||||
const lineHeight = input.font.fontSize * 1.05;
|
||||
|
||||
function drawHeader(): number {
|
||||
@@ -862,7 +862,7 @@ export async function renderSchedulePdf(input: RenderPdfInput): Promise<Buffer>
|
||||
{
|
||||
text: htmlToPlain(isRtl ? meeting.titleAr : meeting.titleEn || meeting.titleAr) +
|
||||
(meeting.location ? `\n${meeting.location}` : ""),
|
||||
align: "center",
|
||||
align: isRtl ? "right" : "left",
|
||||
},
|
||||
{
|
||||
text:
|
||||
@@ -896,7 +896,7 @@ export async function renderSchedulePdf(input: RenderPdfInput): Promise<Buffer>
|
||||
flushGroup();
|
||||
return parts.join("\n");
|
||||
})(),
|
||||
align: "center",
|
||||
align: isRtl ? "right" : "left",
|
||||
},
|
||||
{
|
||||
text: formatTimeRange(meeting.startTime, meeting.endTime, input.lang),
|
||||
@@ -992,9 +992,7 @@ export async function renderSchedulePdf(input: RenderPdfInput): Promise<Buffer>
|
||||
const c = cells[i];
|
||||
const cellW = widths[i] - cellPadX * 2;
|
||||
const textLines = c.text.split("\n");
|
||||
const contentH = cellHeights[i] - cellPadY * 2;
|
||||
const vOffset = Math.max(0, (rowHeight - cellPadY * 2 - contentH) / 2);
|
||||
let y = rowTop + cellPadY + vOffset;
|
||||
let y = rowTop + cellPadY;
|
||||
for (const tl of textLines) {
|
||||
if (y >= rowBottom) break;
|
||||
if (!tl) { y += lineHeight; continue; }
|
||||
|
||||
Reference in New Issue
Block a user