specifying x-coord does not position in absolute space

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #1748 của @JamBalaya56562 — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu tại điểm vào PDFDocument.text và tái hiện ví dụ trình duyệt được cung cấp, tập trung vào các lệnh gọi sử dụng continued: true với tọa độ x tường minh. So sánh các vị trí thu được với căn chỉnh dự kiến khi lệnh gọi văn bản thứ hai sử dụng x=0; được xem là hoàn tất khi các tọa độ x và y hoạt động như được ghi trong các luồng văn bản tiếp diễn.

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

Mô tả

Bug Report

Description of the problem

What I noticed is that the x (and potentially the y coord) is not an absolute position in the text function when 'continued' is set to true
As far as I could read there is no mention of relativity of the coord-position in relation to the continuedflag, but maybe I misunderstood the API.

I know a workaround already, but I would love to know where this relativity is comming from (i.e. where does it anchor to?). As when I set x of the second text to 0 it does not line up with the first text on the same line

Code sample

// create a document and pipe to a blob
var doc = new PDFDocument();
var stream = doc.pipe(blobStream());

// this should line up both the first and second text on each line
doc.text('testing',
{
    continued: true
});
doc.text('test', 200, undefined);
doc.text('testing out',
{
    continued: true
});
doc.text('test', 200, undefined);

doc.moveDown().moveDown();

// this is a work around which I would expect with the above code
const x = doc.x
doc.text('testing', x, undefined);
doc.moveUp();
doc.text('test', 200, undefined);
doc.text('testing out', x, undefined);
doc.moveUp();
doc.text('lolz', 200, undefined);


// end and display the document in the iframe to the right
doc.end();
stream.on('finish', function() {
  iframe.src = stream.toBlobURL('application/pdf');
});

Your environment

Currently (18-08-2025) present on the online version of:
https://pdfkit.org/examples/browserify/browser.html
Not sure which version it is using.

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

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 foliojs/pdfkit

Tất cả issue của foliojs/pdfkit

Issue tương tự

Thêm issue về JavaScript

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.