Jump to content

PDF logo size


ralphonz

Recommended Posts

Hi,

I'm using an unmodified version of the default "Six" theme.  However, the logo in the quote pdf always looks too big - see my attached screenshot.  I reduced the size of the logo and uploaded it to assets/img but then refreshing the pdf quote the logo is exactly the same size just pixilated.  It looks awful.  I don't want to edit template files because its a huge nuisance to update.

How can I get the pdf logo to look half decent?  Surely it should just be ok by default?  Or is there a "best" size for the image to be?

Screen Shot 2017-12-06 at 16.51.07.png

Link to comment
Share on other sites

3 minutes ago, ralphonz said:

 I don't want to edit template files because its a huge nuisance to update.

you may have to. :smile2:

https://docs.whmcs.com/PDF_Invoice_Customisation#Modifying_the_Logo

Quote

The logo displayed on the PDF invoices is in the /assets/img/ folder. To change this logo, upload the required logo to the /assets/img/ folder. The name of the file should be "logo.jpg" or "logo.png".

The width of the logo image can be changed in the invoicepdf.tpl template file. On line 4, adjust the last number "75" before the closing bracket );. This variable defines the image width. A developer can then experiment increasing and decreasing it until happy.

I know the above documentation is about invoices, but the same applies to the quotepdf.tpl template too (as it will likely be using the same image).

Link to comment
Share on other sites

36 minutes ago, ralphonz said:

Does that mean the template doesn't work OTB?  How odd to make a template that doesn't work!

you want it to work for all logos regardless of size.. ?

34 minutes ago, ralphonz said:

Does "75" refer to pixels?

no - think printing, not web... btw, I assume it looks huge on an invoice too?

for a 100x100px image like yours @ 72dpi, the value of '75' in the template should be closer to '35'...

yRNHpga.png

or you cheat by using placeholder.png as the bg, add your logo as a layer over it and then remove the background layer...

bluelogo3.png.f58c029c491f0c3f79428cb5fe7f2dfd.png

 

Link to comment
Share on other sites

Thanks Brian, that clears it up! 

Yeah it's huge on the invoice too :) 

What are the units of the value 75?  Can you explain the maths and how you got 35?  Hopefully I can work out exactly what size it needs to be but I don't understand the relationship between DPI and PX here.

Link to comment
Share on other sites

16 minutes ago, brian! said:

millimetres - the width of the image... first two numbers are the x,y position, 3rd is image width.

 

 

Why when I change the size of the image in px, is the image not actually changing size in the pdf?  It's a different size, both in terms of px and mm.

 

59 minutes ago, brian! said:

you want it to work for all logos regardless of size.. ?

Well yeah, it should resize the logo to fit or whmcs should give an exact size/dpi to create a logo to fit.  Or at the very least the size should be governed by a variable set in the general settings rather than a discrete template file (or multiple template files! - even worse) that may or may not get overwritten on an update.

Link to comment
Share on other sites

21 minutes ago, ralphonz said:

Why when I change the size of the image in px, is the image not actually changing size in the pdf?  It's a different size, both in terms of px and mm.

because the image width is defined in the template - changing it's actual size won't make any difference.

21 minutes ago, ralphonz said:

Well yeah, it should resize the logo to fit or whmcs should give an exact size/dpi to create a logo to fit.

i've always used placeholder as the template... you can come unstuck when messing with multiple dpi's, but that's a story for another day!

21 minutes ago, ralphonz said:

Or at the very least the size should be governed by a variable set in the general settings rather than a discrete template file (or multiple template files! - even worse) that may or may not get overwritten on an update.

I wouldn't argue that you could theoretically move the value into general settings, but this is the way WHMCS have always done their invoice settings (both during my time and before that).

with regards to be overwritten, then the official advice is that if you modify the template files, you use a renamed template folder to avoid the updater overwriting the files.... and i'd recommend keeping a copy locally.

but of all the templates, invoicepdf (and quotepdf) are the ones that you're probably most likely to customise - you can't use hooks to do that, and you may want to change the layout design, the content etc - i've got one installation that uses multiple brands (logos) that displays the correct invoice logo to the client based on their client group setting... if I hadn't edited the invoice template, I wouldn't have been easily able to do that.

Link to comment
Share on other sites

1 minute ago, brian! said:

if I hadn't edited the invoice template, I wouldn't have been easily able to do that

Yeah I hear you there but surely the templates should work and be brand able without any modifications to the code.  If i create a theme by copying the file then when the theme is updated, changes may not be overwritten but no updates will be applied to the theme.  Maintaining any changes is a massive pain.  Especially for something that costs a fair bit to start with.  I used to have a completely customised template I'd created, it was great but stying on top of changes - where, which lines and what - then trying to merge them with updates was a nightmare so I decided to stick with the stock template and not change anything.  I'm after the most simple update and maintenance process possible when it comes to WHMCS!

Seeing as I don't have the original logo anymore could you be so kind as to post it here?  Or just tell me what size/dpi it is?  

Thanks for all the responses Brian, much appreciated.

Link to comment
Share on other sites

3 hours ago, ralphonz said:

Yeah I hear you there but surely the templates should work and be brand able without any modifications to the code.

they are (up to a point) - but these pdf templates are print-based and not web-based... with the client area in Six, the website logo size (well height) is defined in the css not by the size of the image... so in order to change it, you'd need to use custom.css - but an update will overwrite that if you haven't renamed the folder... so it's exactly the same thing.

WHMCS tries to use the same logo for both website and pdf files - /assets/img/logo.png (or jpg) - but as I said earlier, what works in one (web), might not work in the other (print)... so while a 100px logo is resized to 50px by the website; in the pdf, it can give unwanted results... and so editing the template becomes a necessity.

 BUgY1JT.pngNA6P8Wf.png

i'm not even sure there's a foolproof way in PHP to get image dimensions and dpi, so it might be difficult to assign the dimensions in the pdf templates automatically... and even if it can be done, it's going to be easier just to change one figure of 75 in the template. :idea:

3 hours ago, ralphonz said:

 If i create a theme by copying the file then when the theme is updated, changes may not be overwritten but no updates will be applied to the theme.  Maintaining any changes is a massive pain.

that's WHMCS for you - you either accept it as is and don't modify it, or you change it and prepare yourself for having to update it manually... now you can minimise that by using hooks, custom.css and language overrides... but there are ways to do it.

3 hours ago, ralphonz said:

I used to have a completely customised template I'd created, it was great but styling on top of changes - where, which lines and what - then trying to merge them with updates was a nightmare so I decided to stick with the stock template and not change anything.

the release notes for each new release do include a link to the github detailing specifically what's been added/removed.changed since the last release.

https://github.com/WHMCS/templates-six/compare/v7.3.0-release.1...v7.4.1-release.1

Matt did post a blog article last year about using Git to update a custom template... it might be worth a read.

https://blog.whmcs.com/112975/customising-templates-the-easy-way

3 hours ago, ralphonz said:

 I'm after the most simple update and maintenance process possible when it comes to WHMCS!

safest method is not to update unless the new version has something you need, or your current version stops doing what you need it to (and an update fixes that!) :P

3 hours ago, ralphonz said:

Seeing as I don't have the original logo anymore could you be so kind as to post it here?  Or just tell me what size/dpi it is?

you mean the original logo used in invoices/quotes PDF? if so, then I can't as it doesn't exist... WHMCS isn't shipped with a default logo to be used in PDFs, it's for you to upload one as either logo.png or logo.jpg... until that occurs, the pdf templates will use placeholder.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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