dompdf / dompdf/dompdf

Image positioning error

Open
#3,173 6 comments 0 reactions 0 assignees View on GitHub

@bsweeney is already working on this.

Since Jan 26, 2022.

  • #2762 by @bsweeney — open
bug layout
Dominant language
PHP
Stars
11.2k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

I found a strange, but consistent error with image positioning. See the very simple attached file.

  • when including a single image in a div, it gets properly aligned with the div
  • when including two images in the same div, they get shifted above the div
    Using DomPDF 2.0.3.
    test.zip
    test.pdf

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached test.zip and compare its output with test.pdf to reproduce the positioning difference between one and two images in a div. Then trace the image and block layout handling in DomPDF. Done means multiple images remain correctly aligned within their containing div, with the supplied reproduction no longer showing the upward shift.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, php
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.