Jump to content
Sign in to follow this  
GemRock

pdf invoices for admin only

Recommended Posts

Hello!

 

Would be possible show order comments into pdf invoice?

 

Thanks :)

 

there is no reason why comments can't be shown in pdf invoices, although I haven't implemented it and there is no site asking for this as yet.

 

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Great contrib.

Can you tell me how to change the line with invoice in it, I need more space for an translation.

I also vould like to move the payment info down, so i gets it's own line.

 

Regards Teddy

Share this post


Link to post
Share on other sites
Great contrib.

Can you tell me how...

 

i am very sorry but i am afraid i dont have the time to cover customisation of the pdf invoice - 100 shops could have 100 different ideas about what it'd look like. i can only try to answer questions RE installation issues.

 

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Hi. Thanks for the great contribution. It works fine.

 

Does anybody know where to set encoding for Central Europe (cp1250)?

Share this post


Link to post
Share on other sites
Hi. Thanks for the great contribution. It works fine.

 

Does anybody know where to set encoding for Central Europe (cp1250)?

 

Nobody knows? Please.

Share this post


Link to post
Share on other sites

Thanks for your contrib, Ken.

It all works well after a bit of tweaking and customization for multi-language site and the printed pdf file certainly looks a lot better than the page dump I was using as an invoice!

Mike

Share this post


Link to post
Share on other sites

am recieving this error:

 

FPDF error: Missing or incorrect image file: images/br_banner.jpg

 

even after checking post #3 and this is want I have in that file:

 

define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');

 

that is the location for that image. So am I missing something?

 

Thanks.

 

Bennett

Share this post


Link to post
Share on other sites
...define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');...

only you know, where & what is this "store_images" defined?

and after several months you still cant get it work??

 

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

I did remove it some back because of doing some chages to site, but decided to reinstall this mod. Your post # 3 refers to this code in invoice_pdf.php

 

define('INVOICE_TEXT_THANK_YOU', 'Thank you for shopping at');

define('STORE_URL_ADDRESS', 'http://www.yoursite.co.uk');

define('PDF_INV_FOOTER_TEXT', INVOICE_TEXT_THANK_YOU." ".STORE_NAME . ' (your VAT number if any)');

define('PDF_INVOICE_IMAGE', 'images/oscommerce.png');

 

I changed the image file name to br_banner.jpg as this:

 

define('INVOICE_TEXT_THANK_YOU', 'Thank you for shopping at');

define('STORE_URL_ADDRESS', 'http://brs-giftshop.com');

define('PDF_INV_FOOTER_TEXT', INVOICE_TEXT_THANK_YOU." ".STORE_NAME . ' (your VAT number if any)');

define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');

 

The reason why I use store_images/images/br_banner.jpg, because that is where it is located. I do assume we can use our own image in place of the oscommerce image file.

Share this post


Link to post
Share on other sites
I did remove it some back because of doing some chages to site, but decided to reinstall this mod. Your post # 3 refers to this code in invoice_pdf.php

 

 

 

I changed the image file name to br_banner.jpg as this:

 

 

 

The reason why I use store_images/images/br_banner.jpg, because that is where it is located. I do assume we can use our own image in place of the oscommerce image file.

 

 

Thanks, I have it working now.

Share this post


Link to post
Share on other sites
Thanks, I have it working now.

what i said in post #3 is quite general:

Open [admin]/invoice_pdf.php, edit lines 15 to 25 for your shop and your taste (font & colour).
which does not say specifically how you would customise it further.

the error msg you posted does not refer to the folder store_images. you could have simply uploaded the logo to every images folder one of which would work if you dont bother to find out exactly which folder it looks for the logo in. anyway, glad you make it work now.

 

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites
If what you want is nothing more than print/save invoices from admin, and do not want to make lots of changes to your shop, especially database changes, to achieve this little tiny thing, then this is the contribution for you.

 

Here is the installation instruction (if you need it) that is not included in the package:

see it

Share this post


Link to post
Share on other sites

I have installed the script works great other than the image. I called the image oscommerce.jpg which just replaced the one in your script so that it shows. Which it does, the only problem is despite the image being saved at 300dpi it shows really pixilated. Is there anywhere within the script that can stop this from happening and give a much better image quality.

 

Thanks Phil

Share this post


Link to post
Share on other sites
..the only problem is despite the image being saved at 300dpi it shows really pixilated...

 

if your logo quality is good and is not the same size as the original oscommerce.png but shows up in the invoice not as the original size, ie, bigger, then try to change line 104:

$size[0]*PDF_INV_IMG_CORRECTION

which is width, and

$size[1]*PDF_INV_IMG_CORRECTION

which is height, to a number that reflects your logo size. i am not sure what the unit of size there would be, but it seems to be, eg, for 100px you would enter 25. try different number to see which one fits.

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Hello All,

 

Many thanks for this contribution.

 

Is there a way to get the product's image (small) to show on the pdf invoice INSTEAD of the product name ?

 

 

I already have the product images showing up in the standard oscommerce image by using the invoice image contribution ( http://addons.oscommerce.com/info/2904 ) which wrks fine.

Share this post


Link to post
Share on other sites
Is there a way to get the product's image (small) to show on the pdf invoice

there is a will there is a way. but would it be worth the effort? if there are quite a few products on the invoice then the problem it creates could be more than it solves.

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites
there is a will there is a way. but would it be worth the effort? if there are quite a few products on the invoice then the problem it creates could be more than it solves.

Ken

 

 

Thats true, thanks!

Share this post


Link to post
Share on other sites

I have problems in this contribution with the MVS(MultiVendorShiping).

 

Making and order on web with the normal shoping process , when clickig create PDF on admin it works.

 

But if the customers uses MVS options and finalice the order. Then in admin I click on CretePDF and there is not products. All cell in white!!! (extrange)

 

The lines of pdf_invoice.php are these:

 

//Show the products information line by line
.
.
$pdf->MultiCell(18,6,$order->products[$i]['model'],1,'L', '1');
.
.
$pdf->MultiCell(9,6,$order->products[$i]['qty'],1,'C', '1');
.
.
$pdf->MultiCell(128,6,substr($order->products[$i]['name'],0,60),1,'L', '1');
.
.
etc.

Share this post


Link to post
Share on other sites

its not been tested on MVS so sorry dont know whats the problem. I wish i had the time to look into it.

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Hi Ken,

 

Not sure if this is still actively supported, but I previously had this running perfectly in conjunction with PDF Customer Invoices v1.2, but I switched my site to a new domain name and PHP5 earlier this year, and this is now the only thing left that isn't working. I stayed with the same service provider, but just moved to a new domain.

 

As far as I can tell, the only difference between the new and old domain is that I plumped for PHP5 this time. Unfortunately, I am getting the dreaded: FPDF error: Some data has already been output, can't send PDF file and I have uninstalled and reinstalled, but to no avail, and just can't fathom why just a straight swap over will have broken this excellent add-on.

 

Any ideas?

 

Jonathan

Share this post


Link to post
Share on other sites

the error tells you quite clearly: the image (invoice_logo.jpg) file referred to in the invoice_pdf.php was not there (admin/images/).

 

 

 

Ken

 

Thanks.. realised that the error comes from the missing logo. Make sure to insert the logo in your images/ folder and if you have SSL enabled, also paste it into your public_ssl/images/ folder.

Edited by akakai

Share this post


Link to post
Share on other sites

My pdf invoice is missing some text - only showing Sold to:, Deliver to:, Order:# and all the rest of the invoice fields like items and so is missing

My shops address, e-mail and so on is however showing

 

The PDF packing slip is showing correctly with all fields

 

Where can I start to solve this?

 

Please I need help


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

if your logo quality is good and is not the same size as the original oscommerce.png but shows up in the invoice not as the original size, ie, bigger, then try to change line 104:

$size[0]*PDF_INV_IMG_CORRECTION

which is width, and

$size[1]*PDF_INV_IMG_CORRECTION

which is height, to a number that reflects your logo size. i am not sure what the unit of size there would be, but it seems to be, eg, for 100px you would enter 25. try different number to see which one fits.

 

Ken

 

Ken,

 

I've been havng the same problem with the blurry image. Though I cannot find the PDF_INV_IMG_CORRECTION in my files. The pieces of code related to the images I see are:

	//Put an image on the page
if(!isset($this->images[$file]))
{
	//First use of image, get info
	if($type=='')
	{
		$pos=strrpos($file,'.');
		if(!$pos)
			$this->Error('Image file has no extension and no type was specified: '.$file);
		$type=substr($file,$pos+1);
	}
	$type=strtolower($type);
	$mqr=get_magic_quotes_runtime();
	set_magic_quotes_runtime(0);
	if($type=='jpg' || $type=='jpeg')
		$info=$this->_parsejpg($file);
	elseif($type=='png')
		$info=$this->_parsepng($file);
	else
	{
		//Allow for additional formats
		$mtd='_parse'.$type;
		if(!method_exists($this,$mtd))
			$this->Error('Unsupported image type: '.$type);
		$info=$this->$mtd($file);
	}
	set_magic_quotes_runtime($mqr);
	$info['i']=count($this->images)+1;
	$this->images[$file]=$info;
}
else
	$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
	//Put image at 72 dpi
	$w=$info['w']/$this->k;
	$h=$info['h']/$this->k;
}
if($w==0)
	$w=$h*$info['w']/$info['h'];
if($h==0)
	$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
	$this->Link($x,$y,$w,$h,$link);
}

 

in the classes/fpdf.php

 

and the bit below in pdf_invoice.php

 

global $HTTP_GET_VARS, $highlight_color, $date, $image_function, $customer_id;
//Logo
   $this->$image_function(PDF_INVOICE_IMAGE,44,8, FILENAME_DEFAULT);

 

What can I change or delete in order to stop this code messing around with my image size? I am using a 72 DPI jpeg.

 

Thanks,

Tom

Edited by tfoolen

Share this post


Link to post
Share on other sites

...and the bit below in pdf_invoice.php

What can I change or delete in order to stop this code messing around with my image size? I am using a 72 DPI jpeg.

 

Thanks,

Tom

in the file shown above, the full line 104 looks like this (taken from a live shop):

$this->$image_function(PDF_INVOICE_IMAGE,7,10,($size[0]*0.3),($size[1]*0.3),'', FILENAME_DEFAULT);

in the above example, the constant PDF_INV_IMG_CORRECTION has been replaced by actual figures 0.3. try different figures to suit your need.

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×