CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Removing address line gaps when creating Letter PDF
Pages: [1]

Author Topic: Removing address line gaps when creating Letter PDF  (Read 913 times)

sctajc

  • I’m new here
  • *
  • Posts: 5
  • Karma: 1
Removing address line gaps when creating Letter PDF
June 12, 2010, 08:27:07 pm
Is there a way for an individual letter to not print an address line (token) if the value is blank? Some addresses use less lines than normal. Hopefully there is some kind of 'if blank skip' option.

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Removing address line gaps when creating Letter PDF
September 16, 2010, 07:51:42 pm
I took a look at the config file for DomPDF located at /sites/all/modules/civicrm/packages/dompdf/dompdf_config.inc.php according to it you can embed php into the code.

I'm not sure how to evaluate the existance of the Second Address line but something like the following:

Code: [Select]
{contact.individual_prefix} {contact.first_name} {contact.last_name}<br />
{contact.street_address} <br />
<script type="text/php">
 if ({contact.supplemental_address_1} != null) { {contact.supplemental_address_1}<br /> }</script>
{contact.city}, {contact.state_province} {contact.postal_code}

Maybe someone who is better with php and CiviCRM can help with how to get the evaluation to work.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Removing address line gaps when creating Letter PDF
September 16, 2010, 08:54:39 pm
Check out the way the page formatting is done here

http://sandbox.civicrm.org/civicrm/admin/setting/preferences/address&reset=1

I'm think you may be able to do

{
}

in the same way that {, } is used on that page - check the help notes
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Removing address line gaps when creating Letter PDF
September 16, 2010, 09:25:16 pm
If you mean do something like:

<code>
{contact.individual_prefix} {contact.first_name} {contact.last_name}<br />
{contact.street_address} <br />
{contact.supplemental_address_1} {<br /> }
{contact.city}, {contact.state_province} {contact.postal_code}
</code>

OR

<code>
{contact.individual_prefix} {contact.first_name} {contact.last_name}<br />
{contact.street_address} <br />
{{contact.supplemental_address_1} <br /> }
{contact.city}, {contact.state_province} {contact.postal_code}
</code>

Neither of those work.

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Removing address line gaps when creating Letter PDF
September 17, 2010, 01:29:54 am
hey,

I guess you didn't see this blog post: http://civicrm.org/blogs/michael-mcandrew/creating-address-block-token

This'll find its way into core some time soon but in the mean time installing that as a drupal module is the way to go IMO.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Removing address line gaps when creating Letter PDF
September 17, 2010, 07:04:59 am
Ahhh Michael, Thank you!

No my search did not return that for some reason.

Thank you

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Removing address line gaps when creating Letter PDF

This forum was archived on 2017-11-26.