Skip to content

Conversation

@camilevahviraki
Copy link

FIX|Fix #34947 PDF top margin breaks layout in multiple templates

When setting the top margin in PDF configuration, many templates only move the header down while address blocks and table content remain at fixed positions, breaking the layout across multiple document types.

Problem:

The PDF margin layout issue affects multiple templates including but not limited to:

  • Invoice templates (sponge, crabe, octopus, etc.)
  • Proposal templates
  • Order templates
  • Other document templates that use hard-coded positioning

Current Findings:

  • Issue confirmed in pdf_sponge.modules.php with hard-coded positioning values
  • Initial fix implemented for sponge, crabe, octopus, rouget templates demonstrating the solution pattern
  • Investigation ongoing to identify all affected templates across the system

Next Steps:

  1. Identify all affected templates across invoices, proposals, orders, etc.
  2. Apply consistent fix pattern to all identified templates
  3. Comprehensive testing with various margin settings and document types

Technical Details:

  • Replaced fixed position values (40, 42, 90, etc.) with calculations using $this->marge_haute
  • Standardized address block positioning: $this->marge_haute + [offset]
  • Updated table positioning: $this->tab_top = $this->marge_haute + [calculated_offset]
  • Ensured new page positioning respects top margin

This fix will ensures consistent spacing and proper layout across all PDF templates regardless of the configured top margin value, providing a uniform user experience.

@camilevahviraki camilevahviraki marked this pull request as draft October 24, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF top margin breaks layout

1 participant