Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
Invoice PDF Font Change Not Working
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

Now that my brain is permanently bleeding from trying to edit the PDF invoice generation files, I’m having one problem.

I followed the stuff in http://www.magentocommerce.com/wiki/how-to/editing_an_invoice_pdf to edit various things and I made some great progress.

I’ve changed the _setFontRegular, etc to the font I’d like, but the list of products is still in the old font.

Any ideas where I can modify the font for the list of items?

I’ve attached an image showing the problem.

Image Attachments
wrongfont.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

Sigh. Let the thread bumping begin.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vicky
Member
 
Avatar
Total Posts:  50
Joined:  2008-09-28
 

Hi there,

I used your link to adjust my fonts/size.  I kept everything the same but just changed the font to Helvetica and size 8.  I updated two seperate files…

/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php (line 487-507)
/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php (line 255-274)

All my fonts changed to Helvetica, including the one your hightlighted.  You might to double check and make sure you caught all of them. 

Hope this helps you…

Vicky

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

Thanks Vicky! Seems I missed the /Items directory.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SteveM
Jr. Member
 
Total Posts:  20
Joined:  2008-07-25
 

I tried this on 1.1.6 and it didn’t work:

Fatal error: Fatal error: Call to a member function setFont() on a non-object in /home/sites/airsoftscotland/public_html/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php on line 496

I tried this about 6 times and could not get it to work at all. Disabled and refreshed Cache Logged out and back in to Admin, did three summersaults whilst eating a fried penguin, still no luck.

Any ideas? Is this just a copy/paste job or do I have to type in some other ‘Helvetica’s’ elsewhere?

Sorry to sound stupid but I’m not a programmer wink

Steve

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

Steve, can you paste what you have on line 496 so we can get a better idea of what might be causing the problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
medlington
Sr. Member
 
Total Posts:  143
Joined:  2008-04-30
 

Hi,

Iv got lost changing all the co-ordinates in the abstract.php.

any chance of you posting your 2 edited files up so I can just copy them over mine grin

Im on V1.1.6 will they work?

cheers.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cobasa000
Jr. Member
 
Total Posts:  13
Joined:  2008-10-22
 

if you change font sizes, look for function calls widthForStringUsingFontSize and make sure you change the font size being used there too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
medlington
Sr. Member
 
Total Posts:  143
Joined:  2008-04-30
 

Iv stopped trying to change all the co-ordinates in the file because it was driving me mad.

Iv now just changed the font size and the function calls refering to widthforstringusingfontsize.

The invoice is now almost perfect except that a couple of the lines of text are overlapping verticaly slightly. How can I alter the line height? are there similar function calls setting the line height by the font size?

also the last thing is that the word subtotal is just slipping out of the right hand side of the box, does anyone know how I can just nudge that column left abit?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
ameagher
Jr. Member
 
Total Posts:  25
Joined:  2008-10-28
 

grin Hey Josh,

Off topic - but I love the toy store!

Anthony

 
Magento Community Magento Community
Magento Community
Magento Community
 
Leo27
Sr. Member
 
Total Posts:  127
Joined:  2008-10-08
 

hehe, thanks for th thread, really saved me lot of time smile.
Worked perfectly fine, just wanted to change the font, and now all is set.

Thanks again

Best regards
L. Nunes

 
Magento Community Magento Community
Magento Community
Magento Community
 
TPB
Jr. Member
 
Total Posts:  13
Joined:  2008-12-09
 

Inside Abstract.php, I found this comment:

* This is not the most efficient way to perform this calculation. I’m
* concentrating optimization efforts on the upcoming layout manager class.

Does this mean there’s a tool coming out for managing the layout of these PDF files?  If so, any hints as to when it might be available?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
infield
Sr. Member
 
Total Posts:  89
Joined:  2007-11-04
San Francisco
 

Invoice changes get wiped out every time you upgrade. Is there an override directory that the /app/code/core/Mage/Sales/Model/Order/Pdf/ file scan be put in that will live through an update?

Thanks,
-marc

 
Magento Community Magento Community
Magento Community
Magento Community
 
vianetz
Guru
 
Avatar
Total Posts:  537
Joined:  2008-04-13
Munich, Germany
 

You can create your own module.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sgodwin
Jr. Member
 
Total Posts:  3
Joined:  2008-09-10
 

Marc -

Move the file to the local code pool -
/app/code/local/Mage/Sales/Model/Order/Pdf/

Create the same directory structure in /app/code/local instead of app/code/core.  Magento uses the code in the local directory if it’s there, and if not, it uses the code in the core directory.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vicky
Member
 
Avatar
Total Posts:  50
Joined:  2008-09-28
 

Did anyone notice that on the PDF print out, Shipping & Handling actually comes out as Shipping & Handling?  See the screen shot above.  Does anyone know how to fix this?  I can’t find the text anywhere.  UGH

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3