Jump to content

Modify Your PDF Logo Size


JulesR

Recommended Posts

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 :)

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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.

Edited by Damainman
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated