Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

eCommerce Tycoon


You are currently viewing our eCommerce Tycoon as a guest. Please register to participate.
Login



Reply
Magento 1.4 Changing PDF font sizes
Old 02-24-2012, 08:32 AM Magento 1.4 Changing PDF font sizes
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Unless you are the type of person who say, enjoys plunging your hand into chip fryer or poking yourself in the eye with knitting needles or watching the Star Wars prequels sober, you probably want to steer clear of Magento.

But if you ARE that kind of person you may have been wondering about how to change the font sizes on your Magento PDF invoices.
Well the good news is that you can do it all pretty much in one file (if you arent shy about taking a short cut).

Here are two great resources to kick start.
http://www.magentocommerce.com/wiki/...an_invoice_pdf

http://www.magentocommerce.com/boards/viewthread/31533/

You'll need this file
/app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php

And anywhere that it says something like
Code:
$this->_setFontRegular($page);
then party down, because you can directly change the font size by
just tagging on a parameter like this:
Code:
$this->_setFontRegular($page, 8);
Keep in mind that I think these are point sizes not font size per se.
You'll need a bit of trial and error to find the right size.

Other versions of Magento may vary but I found most of what I needed
on these lines:

line 232
line 252
line 278
line 286
line 325
line 331

Then, just to make it interesting, to change the Invoice Items section
you need to do a few different things. Other people have mentioned that
this file /app/code/local/Mage/Sales/Model/Order/Pdf/Items/Abstract.php
is where the action is at but I messed around with that and it didnt change a damned think. pfft.

Anyway to set the font for the header of the invoice items you need
to tackle these.
Code:
line 562 protected function _setFontRegular($object, $size = 8)
line 569  protected function _setFontBold($object, $size = 8)
line 576 protected function _setFontItalic($object, $size = 8)
set the $size = parameter to whatever point size you want.

Next;

The list of items (the products that were bought) is controlled with this

Code:
line $fontSize  = empty($column['font_size']) ? 9 : $column['font_size'];
change the value after the question mark to your desired point size.

Finally;

For the subtotals, shipping and total, the font sizes are controlled in here

Code:
line 415
foreach ($total->getTotalsForDisplay() as $totalData) {
                    $lineBlock['lines'][] = array(
                        array(
                            'text'      => $totalData['label'],
                            'feed'      => 475,
                            'align'     => 'right',
                            //'font_size' => $totalData['font_size'], hard coded in the font size for PDF invoice totals
                            'font_size' => 9,
                            'font'      => 'bold'
                        ),
                        array(
                            'text'      => $totalData['amount'],
                            'feed'      => 565,
                            'align'     => 'right',
                            //'font_size' => $totalData['font_size'], hard coded in the font size for PDF invoice totals
                            'font_size' => 9,
                            'font'      => 'bold'
                        ),
                    );
                }
In theory I think you are suppose to change something in the the Config XML file or such bollocks. But if are willing to go commando you can just hard code the point value as I did above. It works. I'm over it.

Hope that helps somebody. It's late and a glass of red wine and latest episode of Big Bang Theory are beckoning.
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-25-2012, 09:18 AM Re: Magento 1.4 Changing PDF font sizes
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Quote:
The list of items (the products that were bought) is controlled with this


$fontSize = empty($column['font_size']) ? 9 : $column['font_size'];

change the value after the question mark to your desired point size.
I omitted to say this is on line 688 of
/app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID

Last edited by TWD; 02-25-2012 at 09:20 AM..
TWD is offline
Reply With Quote
View Public Profile
 
Old 07-12-2012, 07:49 PM Re: Magento 1.4 Changing PDF font sizes
Novice Talker

Posts: 14
Trades: 0
I haven't yet enjoyed "plunging my hand into chip fryer" Lol!
Actually that was my first impression of Magento, but I have grown to appreciate its greatness.
I have already poked myself in the eye and made a really extensive extension (that sounds good!) to edit the magento pdf font sizes and change the font. It has been developed over the last 2 years on a continous basis - save your hand and your eye! We just released an update, with another one to allow auto-emailing PDFs coming soon.
jim222 is offline
Reply With Quote
View Public Profile Visit jim222's homepage!
 
Reply     « Reply to Magento 1.4 Changing PDF font sizes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20434 seconds with 11 queries