Exact reproduction of a document with ASCII table in React/JavaScript

Đang mở
#1,269 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
15/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, react
Lĩnh vực
frontend

Hướng nghiên cứu

Issue không nêu tệp nào trong repository, entry point hay test cần sửa; trước tiên hãy làm rõ liệu có yêu cầu thay đổi react-component/table hay không. Tái hiện sự tương thích đã nêu với React 18 và JavaScript cùng các yêu cầu về PDF, sau đó xác định output được chấp nhận và một test trước khi triển khai.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I am developing a React application that needs to generate a PDF document with very specific formatting. The main challenge is to reproduce exactly a formatted table using only ASCII characters for borders and structure, while maintaining perfect alignment.
Specific Features of the Document

The document I need to reproduce has these precise characteristics:
It uses simple ASCII characters (:, -) to construct all borders.
Columns are separated by colon characters :
Horizontal lines are made up of repeated dash characters -
The header contains information across multiple lines.
Alignment must remain perfectly stable, character by character.
Spacing between columns must be uniform.
The document exclusively uses a fixed-width (monospace) font.

Here is an example of the exact format I need to reproduce:

Image

Main Issues I'm Facing
When I try to generate this document:

Alignment issues : As soon as I insert text into the cells, the border : characters shift, ruining the vertical alignment.
Line misalignment : The horizontal lines made of - do not align properly.
Inconsistent spacing : I can't maintain uniform spacing between characters.
What makes this particularly difficult is that the document must look exactly like one generated by a dot matrix printer or typewriter — every character must align precisely on an invisible grid.

Attempts Made So Far
I have tried:
Standard HTML tables : Alignment changes depending on content.
CSS-based tables : Borders don’t align correctly.
Monospace fonts with

 tags : I lose alignment when adding content.
Canvas : Hard to place each character precisely.
PDF libraries : Problems with ASCII characters and alignment.
React-PDF : Can’t maintain perfect alignment.
My Technical Environment
React 18.x
JavaScript
Tried libraries: jsPDF, pdfmake, react-pdf, html2canvas
Specific Questions
What would be the best approach to generate a document where each character (including borders) must be placed at a fixed grid position?
How can I maintain perfect alignment of ASCII characters (:, -) regardless of the amount of text?
Are there any techniques to treat the document as a matrix of fixed characters rather than fluid HTML content?
Is there a JavaScript library particularly suited for this kind of "typewriter-style" formatting?
How can I export this document to PDF while preserving perfect character alignment?
I’m ready to completely change my approach if necessary. The key is to faithfully reproduce this very specific format.

Thank you in advance for your help!

Ngôn ngữ chính
TypeScript
Star
1.4k
Fork
618
Merge trung bình
10 giờ 19 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react-component/table

Tất cả issue của react-component/table

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.