Jump to content

Logo Blurry in PDF Invoice


bigmike7801

Recommended Posts

SO each time a generate an invoice, the logo that I've created specifically for the pdf appears blurry.

 

Has anyone else experienced this?

 

I've read the manual for the Imgae function for FPDF (http://www.fpdf.org/en/doc/image.htm)

 

This is what my current logo code looks like in pdfconfig.php

# Logo
$pdf->Image(ROOTDIR.'/images/logo.jpg',20,25);

 

You can see a screen shot I took of the blurry invoice logo here (http://www.marswebcreations.com/test/blurry-logo.jpg)

 

and the original image here: (http://www.marswebcreations.com/client/images/logo.jpg)

 

The dimensions of my image is 200px wide by 68px tall and it's obviously being enlarged for some reason.

 

Does anybody see a problem with this?

Edited by bigmike7801
Add images
Link to comment
Share on other sites

Does anybody see a problem with this?
Well, yes, I agree with you that it is not satisfactory and you are right to wish your company's image to be better presented.

 

I cannot offer any fix for this but suggest that you open a ticket with WHMCS Support to address the issue. It's certainly an important consideration. Best wishes with this.

Link to comment
Share on other sites

Try this... it will resize the image at 150 dots/inch

$pdf->Image(ROOTDIR.'/images/logo.jpg',100,20,75,0,'',$CONFIG['Domain'],'',true,150);
For details on what the settings are for look at the specs for the image function below
method Image [line 4211]

 

image Image( string $file, [float $x = ''], [float $y = ''], [float $w = 0], [float $h = 0], [string $type = ''], [mixed $link = ''], [string $align = ''], [boolean $resize = false], [int $dpi = 300], [string $palign = ''], [boolean $ismask = false], [mixed $imgmask = false], [mixed $border = 0])

Puts an image in the page.

 

The upper-left corner must be given. The dimensions can be specified in different ways:

 

  • explicit width and height (expressed in user unit)
  • one explicit dimension, the other being calculated automatically in order to keep the original proportions
  • no explicit dimension, in which case the image is put at 72 dpi

Supported formats are JPEG and PNG images whitout GD library and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM; The format can be specified explicitly or inferred from the file extension.

It is possible to put a link on the image.

Remark: if an image is used several times, only one copy will be embedded in the file.

 

 

 

Tags:

 

return: information since: 1.1 access: public

 

 

Parameters:

 

string $file Name of the file containing the image.

float $x Abscissa of the upper-left corner.

float $y Ordinate of the upper-left corner.

float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

string $type Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

mixed $link URL or identifier returned by AddLink().

string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

boolean $resize If true resize (reduce) the image to fit $w and $h (requires GD library).

int $dpi dot-per-inch resolution used on resize

string $palign Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

boolean $ismask true if this image is a mask, false otherwise

mixed $imgmask image object returned by this function or false

mixed $border Indicates if borders must be drawn around the image. The value can be either a number:

  • 0: no border (default)
  • 1: frame

or a string containing some or all of the following characters (in any order):

  • L: left
  • T: top
  • R: right
  • B: bottom

Link to comment
Share on other sites

  • 1 month later...

This is a nice start for me to figure out how to fix my logo problem but still not sure as to how to adjust the settings not sure if you have to use every last value and give is a 0 or some other value then insert a comma after each or what.

Link to comment
Share on other sites

  • 1 month later...

an hour or so of trial and error on v4

 

logo 305x112 @72 dpi

 

$pdf->Image(ROOTDIR.'/images/logo.jpg',20,15,75,25);

invoicepdf.tpl

 

hope this helps.

Edited by gr2
Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...
I had luck by creating an image and then adding a parameter (width) to the function:

 

$pdf->Image(ROOTDIR.'/images/logo.jpg',20,15,50);

 

My image is actually 291x170 and this results in a nice sized logo with no blurriness.

 

 

 

 

This method worked for me after playing with the code a little bit

 

$pdf->Image(ROOTDIR.'/images/logo.jpg',20,15,50);

 

20 & 15 placed the logo where you want it and 50 sizes it.

Link to comment
Share on other sites

  • 2 months later...

Just to bump an old thread, just took 1/2 hour to get this right with trial and error on v5 to get rid of the logo blurriness. Really wish this could be updated so that invoice.tpl uses standard html like the other templates and is then read into the system to create the PDF.

 

Seems to be very convoluted at the moment IMHO.

Link to comment
Share on other sites

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