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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • PDF Letter Page Setup
Pages: 1 [2] 3

Author Topic: PDF Letter Page Setup  (Read 18855 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: PDF Letter Page Setup
September 22, 2010, 09:33:47 pm
Check out CRM/Utils/PDF/Label

    protected  $averyLabels =
        array (
               '5160' => array('name' => '5160', 'paper-size' => 'letter', 'metric' => 'mm',
                               'lMargin' => 4.7625, 'tMargin' => 12.7, 'NX' => 3, 'NY' => 10,
                               'SpaceX' => 3.96875, 'SpaceY' => 0, 'width' => 65.875, 'height' => 25.4,
                               'font-size' => 8),
               '5161' => array('name' => '5161', 'paper-size' => 'letter', 'metric' => 'mm', 
                               'lMargin' => 0.967, 'tMargin' => 10.7, 'NX' => 2, 'NY' => 10,
                               'SpaceX' => 3.967, 'SpaceY' => 0, 'width' => 101.6,
                               'height' => 25.4, 'font-size' => 8),
               '5162' => array('name' => '5162', 'paper-size' => 'letter', 'metric' => 'mm',
                               'lMargin' => 0.97, 'tMargin' => 20.224, 'NX' => 2, 'NY' => 7,
                               'SpaceX' => 4.762, 'SpaceY' => 0, 'width' => 100.807,
                               'height' => 35.72, 'font-size' => 8),
               '5163' => array('name' => '5163', 'paper-size' => 'letter', 'metric' => 'mm',
                               'lMargin' => 1.762,'tMargin' => 10.7, 'NX' => 2,
                               'NY' => 5, 'SpaceX' => 3.175, 'SpaceY' => 0, 'width' => 101.6,
                               'height' => 50.8, 'font-size' => 8),
               '5164' => array('name' => '5164', 'paper-size' => 'letter', 'metric' => 'in',
                               'lMargin' => 0.148, 'tMargin' => 0.5, 'NX' => 2, 'NY' => 3,
                               'SpaceX' => 0.2031, 'SpaceY' => 0, 'width' => 4.0, 'height' => 3.33,
                               'font-size' => 12),
               '8600' => array('name' => '8600', 'paper-size' => 'letter', 'metric' => 'mm',
                               'lMargin' => 7.1, 'tMargin' => 19, 'NX' => 3, 'NY' => 10,
                               'SpaceX' => 9.5, 'SpaceY' => 3.1, 'width' => 66.6,
                               'height' => 25.4, 'font-size' => 8),
        #Start Tweak - Circle Interactive formatting
               'L7160' => array('name' => 'L7160', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => 5,
                                'tMargin' => 15, 'NX' => 3, 'NY' => 7, 'SpaceX' => 6, 'SpaceY' => 2.5,
                                'width' => 63.5, 'height' => 38.1, 'font-size' => 9),
        #end tweak
               'L7161' => array('name' => 'L7161', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => 6,
                                'tMargin' => 9, 'NX' => 3, 'NY' => 6, 'SpaceX'=> 5, 'SpaceY' => 2,
                                'width' => 63.5, 'height' => 46.6, 'font-size' => 9),
               'L7163' => array('name' => 'L7163', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => 5,
                                'tMargin' => 15, 'NX' => 2, 'NY' => 7, 'SpaceX' => 25, 'SpaceY' => 0,
                                'width' => 99.1, 'height' => 38.1, 'font-size' => 9)
               );
   
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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: PDF Letter Page Setup
November 07, 2010, 03:18:01 pm
Hi Marty - just wondering if your work on this bore fruits?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: PDF Letter Page Setup
November 07, 2010, 03:30:39 pm
Have raised my issue as separate thread here - http://forum.civicrm.org/index.php/topic,16462.msg70280.html#new
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
November 07, 2010, 10:50:27 pm
Yes, I've got working code for configuring page formats for PDF letters and mailing labels.  I'll look into including it with printing contribution receipts.  Hopefully I'll have code ready to contribute soon.

MartinB

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5.x
Re: PDF Letter Page Setup
April 05, 2011, 05:40:10 pm
Hi,

Is there any progress in the very nice feature that was suggested in this topic ?

For us here it would be so nice to be able to change the paper size and margin when we create some PDF. I'm still trying to figure how we can reach our goal and the new feature would be a breaktrough for us.

Thanks,

Martin

theMusician

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 3
  • CiviCRM version: 4.0 and 4.0.1
  • CMS version: Drupal 7.0
  • MySQL version: MySQL 5.x
  • PHP version: 5.2
Re: PDF Letter Page Setup
April 11, 2011, 04:13:45 pm
Hi Marty,

This is a great feature you have developed. I am still exploring how to use civi for several different use cases but the ability to set margins on pdf templates is brilliant. Several of my cases need this feature and I am happy to see that your work has evolved into such a fine looking addition to this project.

Kudos for your work.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: PDF Letter Page Setup
April 12, 2011, 04:53:17 pm
Hmm - haven't seen anything committed or posted on this front. Have you? Do share :-)
Protect your investment in CiviCRM by  becoming a Member!

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
April 13, 2011, 09:49:45 pm
Sorry I've been away from this for a while, but I'm finally back to working on this effort. I've completed the work to add the ability to configure PDF letter formats and also to configure mailing label formats. I've attached screen captures showing the new admin dialogs and user interface changes to the PDF Letter creation dialog.

I'm ready to commit the changes to the base, but I may need some guidance on the best way to do that since the change set is rather large (about 19 modified files and 11 new files).  Do I just create a new issue and attach the patches and new files, or is there is there some other process for committing something like this?

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
April 13, 2011, 09:53:28 pm
More screen captures attached.

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
April 13, 2011, 09:54:50 pm
More screen captures attached.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: PDF Letter Page Setup
April 14, 2011, 10:26:42 am

wow :)

most excellent work indeed marty!

I think we should aim to get this into 3.4.1 / 4.0.1 (considering that 3.4 / 4.0 stable is around the corner)

Wanna file an issue and attach your combined diff to it. Make sure all your "new" code is properly licensed and copyrighted. Some guidelines here:

http://civicrm.org/licensing

Would also be great if you can hang out on IRC, so we can chat and ask questions in real time etc :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
April 27, 2011, 04:05:49 pm
A new issue has been opened (CRM-7981) and the diffs attached.  Current plan is to include this in 3.4.2.

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: PDF Letter Page Setup
May 06, 2011, 11:28:32 am
Great work on the margins feature, I can't wait for the next release!

I can set the left margin in PDF message templates to very close to the left side (-40pt) with <div style="margin: -30pt 54pt 54pt -40pt;>, but the top margin (-30pt) is ignored...

So if I want to set the top margin manually for PDF message templates, where can I find the equivalent of the Label.php, where the margins are defined? Or does it perhaps not exist?
« Last Edit: May 06, 2011, 11:31:27 am by resga »

Marty

  • I post occasionally
  • **
  • Posts: 67
  • Karma: 14
    • Boulder County Arts Alliance
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.37
  • PHP version: 5.4.27
Re: PDF Letter Page Setup
May 06, 2011, 01:18:39 pm
There will be a new option under Administer CiviCRM -> Configure -> PDF Page Formats that will allow you to configure the paper size, orientation (portrait or landscape), and page margins (top, bottom, left, and right) to use with message templates.  An example screenshot is shown in an attachment on Reply #24 above (you need to login with CiviCRM Forums to view attachments).

You should be able to get rid of the margin DIV's in your templates and use the new Page Format margin settings instead.  The new configured settings will be easier to use because you can specify the margins in whatever units are best for you (inches, millimeters, centimeters, or points).

resga

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 3
  • CiviCRM version: 3.4.2
  • CMS version: Drupal
  • MySQL version: 5.1.41
  • PHP version: 5.3
Re: PDF Letter Page Setup
May 06, 2011, 01:39:04 pm
Thanks for the answer Marty, that sounds wonderful! Managing PDF templates will become so much easier. I am in a bit of a hurry to launch the site though, so I will use this temporary solution until version 3.4.2 is released.

I found the place PDF margins are defined, in sites/all/modules/civicrm/CRM/Contact/Form/Task/PDFLetterCommon.php -- so I changed line 175 from

 
Code: [Select]
$html = '<html><head><style>body { margin: 56px; }</style></head><body>';
    to
 
Code: [Select]
$html = '<html><head><style>body { margin: 0px; }</style></head><body>';
...and inserted <div style="margin: 20pt 54pt 54pt 20pt;> for the desired position. I know, never hack core 8o)
« Last Edit: May 06, 2011, 01:41:13 pm by resga »

Pages: 1 [2] 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • PDF Letter Page Setup

This forum was archived on 2017-11-26.