Skip to content

Y position of document not updated after adding image #1523

@Pyozer

Description

@Pyozer

Bug Report

Description of the problem

On version 0.14.0 (and lower?), when you add an image, the Y position of the document is automatically updated.
So if we add another image, with moveDown or not, it will be below the first (same with the text, etc...).

But now in version 0.15.0, Y position is not updated after adding an image, so when we add another element (image or text), it is on top of the first one.

So there is a bug/regression in the new version 0.15.0.

Code sample

const doc = new PDFDocument({ layout: 'portrait', size: 'A4' });

doc.image(path.join(assetsPath, '/test1.jpg'), { width: 250 });
doc.moveDown(5);
doc.image(path.join(assetsPath, '/test2.jpg'), { width: 250 });

doc.end();

Here is the result of the sample code in 0.14.0 :

Capture d’écran 2024-05-31 à 18 45 08

And here the result in 0.15.0 :

Capture d’écran 2024-05-31 à 18 43 22

Your environment

  • pdfkit version: 0.15.0
  • Node version: 20
  • Browser version (if applicable):
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions