Add support for rounded corners on table borders.
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu với PDFKit Browser Demo và các entry point hiện có của roundedRect và phần render bảng được hiển thị trong ví dụ. Xác định cách các góc ngoài được bo tròn cần cùng tồn tại với header, footer và các đường kẻ hàng, cột bên trong, sau đó kiểm tra PDF được tạo ra cho các trường hợp đường viền bảng được yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature Request
🧩 Use Case
When generating PDFs with tables, we often want to improve the aesthetics by applying rounded corners to just the outer border of the table — for example, applying a radius to:
Top-left and top-right corners of the table header
Bottom-left and bottom-right corners of the table footer or last row
Or the entire table if it’s wrapped in a border
📌 Current Workaround
Right now, we work around this by:
Drawing a roundedRect manually around the table
Then manually drawing all the internal horizontal and vertical lines
Carefully avoiding overlapping the outer rounded corners with rect or lineTo calls
While this works, it’s tedious and error-prone, especially for dynamic tables with variable rows and columns.
Feature description
Example of a hacky solution to execute on the PDFKit Browser Demo
// create a document and pipe to a blob
var doc = new PDFDocument();
var stream = doc.pipe(blobStream());
// ========== Clean Table with Rounded Outer Border Only ==========
const table = {
headers: ['Name', 'Age'],
rows: [
['Alice', 30],
['Bob', 25],
]
};
const startX = 100;
let startY = 420;
const rowHeight = 30;
const colWidths = [200, 100];
const radius = 8;
const totalWidth = colWidths.reduce((a, b) => a + b, 0);
const totalHeight = rowHeight * (1 + table.rows.length); // header + rows
// Draw outer rounded border only
doc
.roundedRect(startX, startY, totalWidth, totalHeight, radius)
.stroke();
// Draw horizontal lines (rows)
for (let i = 1; i < table.rows.length + 1; i++) {
const y = startY + i * rowHeight;
doc.moveTo(startX, y).lineTo(startX + totalWidth, y).stroke();
}
// Draw vertical lines (columns)
let colX = startX;
for (let i = 0; i < colWidths.length - 1; i++) {
colX += colWidths[i];
doc.moveTo(colX, startY).lineTo(colX, startY + totalHeight).stroke();
}
// Add text
let textY = startY + 10;
// Header
let textX = startX;
table.headers.forEach((header, i) => {
doc.text(header, textX + 5, textY);
textX += colWidths[i];
});
// Rows
startY += rowHeight;
table.rows.forEach((row) => {
textX = startX;
row.forEach((cell, i) => {
doc.text(cell.toString(), textX + 5, startY + 10);
textX += colWidths[i];
});
startY += rowHeight;
});
// end and display the document in the iframe to the right
doc.end();
stream.on('finish', function() {
iframe.src = stream.toBlobURL('application/pdf');
});
`
<!-- You have examples or an idea how it can be implemented? -->
- Ngôn ngữ chính
- JavaScript
- Star
- 10.7k
- Fork
- 1.2k
- Merge trung bình
- 21 giờ 41 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của foliojs/pdfkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
foliojs/pdfkit#1804 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PDFKit crashes when providing fonts as Buffer in tableCó thể đã có người làm @ykw9263 đã nhận 133 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
foliojs/pdfkit#1743 · 13 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
foliojs/pdfkit#1635 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Get detailed font metricsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foliojs/pdfkit#1512 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Upgrade codemirrorĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của foliojs/pdfkit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
parse-community/parse-server#10871 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
521xueweihan/HelloGitHub#4270 ·
-
502 on Node 26: ERR_INVALID_ARG_VALUE: Setting the TLS ServerName to an IP address is not permittedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
c1overzz/dsh-bili-scroll#189 ·
Maintainer thường phản hồi trong vòng 1 ngày