Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9340

Margin settings in PDF Page Formats are off by one-half inch

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.5, 4.1.0
    • Fix Version/s: 3.4.8, 4.0.8
    • Component/s: None
    • Labels:
      None

      Description

      A newer version of the dompdf package introduced in CRM-8333 has caused the margin settings in PDF Page Formats to be about 1/2 inch larger than the settings. This is a result of dompdf supporting CSS3 @page styles to define page margins.

      If you create a PDF Letter with this HTML: <div>This is my letter.</div>, and set the Page Format margins to zero, then the text in the resulting PDF will still have a 1/2 inch top and left margin.

      The fix is to change line 72 in CRM/Utils/PDF/Utils.php from this:

      <style>body { margin: {$t}{$metric} {$r}{$metric} {$b}{$metric} {$l}{$metric}; }</style>

      to this:

      <style>@page { margin: {$t}{$metric} {$r}{$metric} {$b}{$metric} {$l}{$metric}; }</style>

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              marty Marty Wright
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: