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) »
  • Changing the Font in a Printed PDF?
Pages: [1]

Author Topic: Changing the Font in a Printed PDF?  (Read 3097 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Changing the Font in a Printed PDF?
May 16, 2012, 12:28:24 am
Hi there.

I've tried in 3.4.8

<span style="font-family: Arial">
and
<font face="Arial"">

Neither seem to have any effect when a PDF is printed using a template.

Any idea how to get the DomPDF to recognize font choice?
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Rajesh

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 10
  • CiviCRM version: 4.2.x, 4.3.x, 4.4.x
  • CMS version: Drupal 7.xx, Wordpress 3.5.x - 3.6.x, Joomla 3.1
  • MySQL version: 5.5.20
  • PHP version: 5.3.10
Re: Changing the Font in a Printed PDF?
May 16, 2012, 08:02:01 am
Hi there

I have done this before, for adding 'Calibri' font to the CKEditor and making it available in dompdf when printing PDF letters

Please download the font archive from http://dl.dropbox.com/u/34943170/Calibri_fonts.rar

Below are the steps i followed to make it work

To add 'Calibri' font to CKEditor

1. Copy the file 'calibri.ttf' from the downloaded archive to 'sites/all/modules/civicrm/packages/ckeditor/fonts'
2. Add the following to 'sites/all/modules/civicrm/packages/ckeditor/config.js'

config.font_names = 'Calibri;' + config.font_names;

Code: [Select]
/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
//config.uiColor = '#AADC6E';
   
    // disable auto spell check
    config.scayt_autoStartup = false;
   
    // This is actually the default value.
    config.toolbar_Full =
    [
        ['Bold','Italic','Underline'],
        ['Font','FontSize'],
        ['TextColor','BGColor'],   
        ['Link','Unlink'],
        ['Image','HorizontalRule','Smiley'],
        ['NumberedList','BulletedList','Outdent','Indent','Blockquote'],     
        ['PasteText','PasteFromWord','SpellChecker'],
        ['RemoveFormat'],
        ['Undo','Redo'],
        ['Source','-','Preview','-','About'],
    ];
   
    config.font_names = 'Calibri;' + config.font_names;
   
};

3. Add the following to the end of 'sites/all/modules/civicrm/packages/ckeditor/contents.css' file

Code: [Select]
@font-face { 
    font-family: "Calibri";
    font-size: 12px; 
    /*src: url( fonts/helvetica.eot); /* IE */ 
    src: local("Calibri"), url("fonts/calibri.ttf") format("OpenType"); /*non-IE*/ 
}

Now you will be getting 'Calibri' font in the CkEditor font list


To add 'Calibri' font to dompdf

1. Copy all the files from the downloaded archive to 'sites/all/modules/civicrm/packages/dompdf/tests'
2. In command prompt, navigate to 'sites/all/modules/civicrm/packages/dompdf/' and Run the command to install the font in dompdf

This step will create .afm files for the True Type Font files using tt2pt1 utility. If Windows machine, you need to download the font convertor (ttf2pt1.exe) from http://www.columbia.edu/~em36/wpdos/typeinstall.html

Please check the path of the tt2pt1 utility at 'sites/all/modules/civicrm/packages/dompdf/dompdf_config.inc.php' around line number  183, before running the below command

Code: [Select]
php -f load_font.php -- Calibri tests/calibri.ttf
Now you should be able to print PDFs in Calibri font.

It works fine in CiviCRM 4.1.2
« Last Edit: May 16, 2012, 08:09:47 am by Rajesh »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Changing the Font in a Printed PDF?

This forum was archived on 2017-11-26.