Cannot set margins with SetMargins

Aperta
#1,903 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Start with the Mpdf class: compare how SetMargins stores its arguments with how the constructor config sets the bottom margin, and check where left and right margins are read when the page is laid out. Reproduce with the snippet in the issue, which calls SetMargins(50,50,50) and then WriteHTML, and confirm the bottom margin and the left/right margins match the constructor values. Done means the bottom, left and right margins take effect through SetMargins as they do through the constructor, with a test covering that. The issue has been open for about three years with one comment and no maintainer decision, so confirm the approach before writing code.

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

Descrizione

Guidelines
Description of the bug

SetMargins does not support margin-bottom as the constructor config does, plus margin-left and margin-right are not taken into consideration.

This how I fixed the output in my project https://github.com/elaborate-code/row-bloom/commit/683fcd483b428328280fd43263f261afce2b98b6

mPDF version

v8.1.6

PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)

PHP 8.1.6 (Simply running a script with php ./script.php)

Reproducible PHP+CSS+HTML snippet suffering by the error
// script.php

use Mpdf\HTMLParserMode;
use Mpdf\Mpdf;

$mpdf = new Mpdf();

$mpdf->SetMargins(50,50,50);

$mpdf->SetHeader('foo');
$mpdf->SetFooter('foo');
$mpdf->WriteHTML('<p>foo</p>');
$mpdf->WriteHTML('', HTMLParserMode::HEADER_CSS);

$mpdf->OutputFile(__DIR__.'./bar.pdf');
Lingua principale
PHP
Stelle
4.7k
Fork
1.1k
Merge medio
6g 11h
PR unite (30g)
4

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 mpdf/mpdf

Tutte le issue di mpdf/mpdf

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.