View Full Version : Modify Your PDF Logo Size
I spent some time today trying to figure out how to replace the logo in the PDF invoices, and based on some of the posts in these forums and a little digging around, I managed to figure it out. Hopefully this will help anyone else looking for information:
The file you need to edit is: templates/<templatename>/invoicepdf.tpl
Replace "<templatename>" with the name of the template you're currently using.
Look for this section at the top:
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);
We can add some additional values to this line to specify the image width and height, but these values need to be specified in mm and not pixels as you may assume. If you need to determine the size in mm based on the current pixel dimensions of your image, you can use a calculator here:
http://www.unitconversion.org/typography/pixels-x-to-millimeters-conversion.html
Once you've obtained your dimensions, replace the PHP line above to something like this:
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25,widthinmm, heightinmm);
Replace widthinmm and heightinmm to their respective numeric values.
Save the file, and hey presto, you should be good to go :)
fearmydesign
07-30-09, 03:03 AM
This is really helpful, thank you for posting these instructions.
Weird.. I tried this and the image size is still bloated. The logo also moved to the middle of the pdf instead of left justified.
hostwire
07-31-09, 05:31 PM
Weird.. I tried this and the image size is still bloated. The logo also moved to the middle of the pdf instead of left justified.
Just change the coordinates/margins
From this
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);
to this
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,5);
Just change the coordinates/margins
From this
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);
to this
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,5);
I've been trying the same thing myself.
I decided to try removing the 20,5 entirely to see if I could get it to stop screwing with the image.
Unfortunately, it's still overblown. I'm frustrated with trying to resize it, and I don't think I can resize the image down any further before it becomes unreadable.
hostwire
07-31-09, 10:37 PM
How are you testing to see if it is working or not. I modified it and it worked without issue for me.
Might want to try this as well at the top of file.
$pdf->Image('http://yourdomain/whmcs/templates/templatename/images/business_logo.gif',20,5);
This was a great help, thanks for posting.
If it's still bloated, make sure you converted pixels to MM correctly using the link above. Pixels will not work and will leave the image looking very bloated since they are much larger in scale than MM.
You shouldn't need to modify the margin at all, regardless of image size.
Alliance
08-06-09, 02:57 AM
thanks a lot
Any idea whether it works with version 3.8.2 as well? ;)
Assuming the PDF invoice generation process hasn't changed much (and I don't believe it has at all), it should work fine. Are you having problems getting it working?
pblakstad
08-07-09, 06:13 PM
This does not work for me either. Nothing happens with the size of the logo. I've converted pix to mm.
Anyone?
It works fine in the latest version of WHMCS. If you're running an earlier version, I suggest upgrading.
pblakstad
08-07-09, 07:21 PM
I have the latest version but it still does not work.
If you followed the instructions it should work perfectly fine. Are you sure you edited the file in the correct template?
pblakstad
08-07-09, 07:31 PM
Actually, that might be the issue. I'll test.
Thanks for the tips. :)
If in doubt, edit them all, it can't hurt ;)
pblakstad
08-07-09, 07:38 PM
Ok, now i feel really stupid. I edited the wrong template. It works fine now :)
Sorry for wasting your time and thanks alot for your help :)
No problem, glad it's working for you :)
pblakstad
08-07-09, 07:53 PM
Perhaps you have a solution to this problem also: http://forum.whmcs.com/showthread.php?t=22635 ?
I responded to your post, but don't hijack this thread please. This is for the discussion of the PDF logo changes only.
cyberneticos
09-28-09, 04:05 PM
excellent,. I was trying to convert using Photoshop, and did not work, your link worked perfectly.
Thanks !
I have to thank you for that.
Worked like a charm! ;)
Damainman
10-08-09, 12:35 AM
I'm having the same issue as well. Here is what my line looks like: (I'm running the latest WHMCS, uncustomized)
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25,35,26);
The file i'm editing is:
- /templates/default/quotepdf.tpl
Update:
Nevermind, I needed to update the portal template instead!! lol. Your awesome!! :) Thanks for this amazing tip.
alinagosh
10-16-09, 10:52 AM
Yup latest version didn't work for the latest sites & sizes .I also tried on my own site & on blog also.I wanna get more information about latest version why its not successful as previous was.
If i'm not mistake (from the changelog), the latest version of WHMCS has an updated version of the script used to generate the PDF's. When I get time to look, I'll see if anything has changed.
suhailc
10-28-09, 10:44 AM
If i'm not mistake (from the changelog), the latest version of WHMCS has an updated version of the script used to generate the PDF's. When I get time to look, I'll see if anything has changed.
Hi,
Same issue in WHMCS V4.1.1 - logo gets expanded and isn't fully left justified.
Your input would be much appreciated.
gazfocus
12-02-09, 01:28 PM
Followed instructions exactly but logo still looks blurred. Any ideas?
I have the same problem. I converted pixels to mm and entered those values. Still bloated. This is driving me nuts. Latest WHMCS.
9thnode
02-14-10, 06:47 AM
Bump - same issue here - latest version as well.
Unihost
02-20-10, 06:55 AM
We actually need to know what the path is, because everybody seems to strip out <templatepath> - do we actyally change this in the Order form folder, default folder or portal folder?
I just cannot find that logo that appears on my invoice, Ive tried all folders - I use the tampletate
Portal in Admin
mydomain.co.za/whmcs/templates/portal/images/ << There is no jpg or jpeg in this folder - So I dont know where the invoice is getting this logo from at all
and the logo that appears in my invoice is just not in there, and this is the path in my invoicepdf.tpl
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);
Can anybody help me please.
mydomain.co.za/whmcs/images/logo.jpg
hostpro2u
08-15-10, 01:32 PM
What if I want to put the logo at the right side of the invoice? What should I do?
I spent some time today trying to figure out how to replace the logo in the PDF invoices, and based on some of the posts in these forums and a little digging around, I managed to figure it out. Hopefully this will help anyone else looking for information:
The file you need to edit is: templates/<templatename>/invoicepdf.tpl
Replace "<templatename>" with the name of the template you're currently using.
Look for this section at the top:
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);
We can add some additional values to this line to specify the image width and height, but these values need to be specified in mm and not pixels as you may assume. If you need to determine the size in mm based on the current pixel dimensions of your image, you can use a calculator here:
http://www.unitconversion.org/typography/pixels-x-to-millimeters-conversion.html
Once you've obtained your dimensions, replace the PHP line above to something like this:
# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25,widthinmm, heightinmm);
Replace widthinmm and heightinmm to their respective numeric values.
Save the file, and hey presto, you should be good to go :)
I was looking for this, thank you!!!
Ok I got my image to work using the following. Only Modify the second number and the last number. The second number is the vertical placement, and the last number represented the proportion/zoom. Change those numbers until your image looks right. I am using the latest version of WHMCS as of today.
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,20,0,25)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.