Answers.Body: <p>The PDF is just a background so it will require some coding ability if you want to customize the tax receipt.</p>
  <p>You need to create an extension with an implementation of <code>hook_cdntaxreceipts_writeReceipt</code> to write the text wherever you want on the page.</p>
  <p>The default is implemented in file <code>cdntaxreceipts.functions.inc</code> -&gt; <code>function _cdntaxreceipts_writeReceipt</code>. This is called 3 times with an offset but you can decide to print only one copy and place the information where you want (as long as you do print the required information).</p>
  <p>It should looks like :</p>
  <pre><code>/**
   * Implements hook_cdntaxreceipts_writeReceipt().
   *
   */
  function myextension_cdntaxreceipts_writeReceipt(&amp;$f, &amp;$pdf_variables, &amp;$receipt) {
  
    // starting point on the page
    $mymargin_top = $pdf_variables['mymargin_top'];
    $mymargin_left = $pdf_variables[&quot;mymargin_left&quot;];
  
    // define font size
    $pdf-&gt;SetFont('Helvetica', '', 8);
  
    // position based on margin
    $pdf-&gt;SetX($mymargin_left + 50);
    $pdf-&gt;SetY($mymargin_top + 10);
  
    // printing text
    $pdf-&gt;Write(10, CRM_Core_BAO_Setting::getItem(CDNTAX_SETTINGS, 'org_name'), '', 0, 'R', TRUE, 0, FALSE, FALSE, 0);
  
    ...
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-23T01:10:57.067Z
Answers.Text: Thank you for help!  I guest I could also modify directly the function in the cdntaxreceipts.functions.inc .   Would not be easier for a newcomer like me?  I'm seeing somes variables extracted from &$pdf_variables.  Any idea where it is define? Could you change it throught CiviCRM somewhere?
Answers.UserDisplayName: Syxys
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-24T14:10:36.107Z
Answers.Text: I decided to go the easy way and made the modification right in the original file after making a backup.  I found out that the variable $pdf_variables was defines somewhere before in the same file.  Thank again for your help!
Answers.UserDisplayName: Syxys
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-26T23:30:57.127Z
Answers.Text: You can do that but keep in mind that you might have trouble upgrading the extension if required later on.
Answers.UserDisplayName: samuelsov
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-21T20:13:10.830Z
Answers.LastActivityDate: 2022-07-21T20:13:10.830Z
Answers.UserDisplayName: samuelsov
Body: <p>As a new user of CiviCRM, I have been looking around for instruction how to modify the layout of the Donation Tax receipts.</p>
  <p>In the Donation Tax Receipt configuration page you can specify a pdf template. Is there any field I should define in the pdf or is it just a plain pdf file?</p>
  <p>If I need to change the layout of the printout how should I proceed?</p>
  <p>I selected a pdf template and I joined a copy of the actual output I get at this point.</p>
  <p>Any helps will be greatly appreciated.
  Regards</p>
  <p>Using WP v6.0.1, CiviCRM v5.50.1, CDN Tax Receipt v1.6.0</p>
  <p><a href="https://i.sstatic.net/lAqdw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lAqdw.png" alt="enter image description here" /></a></p>
  
Tags: <cdn-tax-receipts>
Title: CiviCRM CDN Tax Receipts extension. How do you modify the layout?
ThreadText: # CiviCRM CDN Tax Receipts extension. How do you modify the layout?
  
  (Asked by: username_0 on 2022-07-21)
  
  As a new user of CiviCRM, I have been looking around for instruction how to modify the layout of the Donation Tax receipts.
  
  In the Donation Tax Receipt configuration page you can specify a pdf template. Is there any field I should define in the pdf or is it just a plain pdf file?
  
  If I need to change the layout of the printout how should I proceed?
  
  I selected a pdf template and I joined a copy of the actual output I get at this point.
  
  Any helps will be greatly appreciated.
  Regards
  
  Using WP v6.0.1, CiviCRM v5.50.1, CDN Tax Receipt v1.6.0
  
  [![enter image description here](https://i.sstatic.net/lAqdw.png)](https://i.sstatic.net/lAqdw.png)
  
  **Tags:** cdn-tax-receipts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-21. Score: 1 | Accepted answer
  
  The PDF is just a background so it will require some coding ability if you want to customize the tax receipt.
  You need to create an extension with an implementation of hook_cdntaxreceipts_writeReceipt to write the text wherever you want on the page.
  The default is implemented in file cdntaxreceipts.functions.inc -> function _cdntaxreceipts_writeReceipt. This is called 3 times with an offset but you can decide to print only one copy and place the information where you want (as long as you do print the required information).
  It should looks like :
  /**
   * Implements hook_cdntaxreceipts_writeReceipt().
   *
   */
  function myextension_cdntaxreceipts_writeReceipt(&$f, &$pdf_variables, &$receipt) {
  
    // starting point on the page
    $mymargin_top = $pdf_variables['mymargin_top'];
    $mymargin_left = $pdf_variables["mymargin_left"];
  
    // define font size
    $pdf->SetFont('Helvetica', '', 8);
  
    // position based on margin
    $pdf->SetX($mymargin_left + 50);
    $pdf->SetY($mymargin_top + 10);
  
    // printing text
    $pdf->Write(10, CRM_Core_BAO_Setting::getItem(CDNTAX_SETTINGS, 'org_name'), '', 0, 'R', TRUE, 0, FALSE, FALSE, 0);
  
    ...
  }
  
  > **Comments:**
  > **username_0**: Thank you for help!  I guest I could also modify directly the function in the cdntaxreceipts.functions.inc .   Would not be easier for a newcomer like me?  I'm seeing somes variables extracted from &$pdf_variables.  Any idea where it is define? Could you change it throught CiviCRM somewhere?  
  > **username_0**: I decided to go the easy way and made the modification right in the original file after making a backup.  I found out that the variable $pdf_variables was defines somewhere before in the same file.  Thank again for your help!  
  > **username_1**: You can do that but keep in mind that you might have trouble upgrading the extension if required later on.  
  
  ---
  
  