specifying x-coord does not position in absolute space

Aperta
#1,641 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #1748 di @JamBalaya56562 — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
javascript
Ambito
api

Direzione di ricerca

Inizia dal punto di ingresso PDFDocument.text e riproduci l’esempio browser fornito, concentrandoti sulle chiamate che usano continued: true con coordinate x esplicite. Confronta le posizioni risultanti con l’allineamento previsto quando la seconda chiamata di testo usa x=0; il lavoro è completato quando le coordinate x e y si comportano come documentato nei flussi di testo continuati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
10.7k
Fork
1.2k
Merge medio
21h 41m
PR unite (30g)
27

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di foliojs/pdfkit

Tutte le issue di foliojs/pdfkit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.