Jump to content

Want to have your pdf invoices a littlebit more professional ?


Recommended Posts

When a customer opens your pdf invoice he can have a look at the properties of the pdf file.

 

We changed our pdfconfig.php file a little so when one of our customers decides to have a look at the properties he will see the following Personalized information:

 

// set document information 

$pdf->SetAuthor("DutchNet"); 
$pdf->SetTitle("Hosting Invoice"); 
$pdf->SetSubject("Invoice for Hosting and Domain services"); 

The Title can even be a bit more fancy if you add the invoice number to the Title like:

$pdf->SetTitle($invoiceprefix.' : '.$invoicenum);

 

the above line should be added just below:

# Header Bar
$invoiceprefix = $_LANG["invoicenumber"];
/*
** This code should be uncommented for EU companies using the sequential invoice numbering so that when unpaid it is shown as a proforma invoice **/
if ($status!="Paid") {
$invoiceprefix = $_LANG["proformainvoicenumber"];
}

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

If you really want professional PDF invoices, I would suggest that you do what we have done where I work at the moment. Make a HTML template, replace values in this template (such as "{client_name}" etc), write out a temp file and render a PDF with wkhtmltopdf (google it!).

 

This has allowed us to create very professional looking PDFs.

Link to comment
Share on other sites

If you really want professional PDF invoices, I would suggest that you do what we have done where I work at the moment. Make a HTML template, replace values in this template (such as "{client_name}" etc), write out a temp file and render a PDF with wkhtmltopdf (google it!).

 

This has allowed us to create very professional looking PDFs.

 

nice idea, but at the moment i would prefer a PHP-only solution.

Link to comment
Share on other sites

  • 4 weeks later...

hi, thanks i found them..

the files that generate pdf are, includes\ , tcpdf.php , tcpdf_unicode.php

and template\[tempatename]\invoicepdf.tpl ,

 

thank u all for replying :x

 

look at my attachment . it is a part from the generated pdf .

 

 

http://forum.whmcs.com/attachment.php?attachmentid=1238&stc=1&d=1261978031

 

i have read some where that i should replace the fonts with tcpdf UTF-8 fonts. but i didnt find anything specific about it . every where they just said that tcpdf is compatible with utf-8. and the samples worked fine . :( i dont know why whmcs cannot work correct.

 

it only shows squares.

Edited by LAZer414
Link to comment
Share on other sites

the strange thing is that for arabic/persian utf8 characters it brings square or ? instead of characters.

i have downloaded the latest tcpdf , and replaced the font files but no changes.

then i tried the samples of tcpdf and found that if the text on the source of the page being readable then it generates a good pdf.

so i have converted my database from latin to UTF-8.

now my data in the pages are correctly readable , and the data in the database is also readable in phpmyadmin :D and everything is UTF-8. but when i generate a pdf file still it brings squares.

 

i tried changing the fonts to the following fonts that works fine for arabic/persian characters. zarbold,almohanad,dejavusans. but i think whmcs do not use them at all!

because after uploading those fonts to the includes\fonts dir , and setting the font nam ein the invoicepdf.tpl,

// set font

$pdf->SetFont('dejavusans', '', 12);

 

still it shows squares. i have deleted fonts from my ftp . and it still shows squares ! i`m getting mad... :D

look at my attachment . it is a part from the generated pdf .

 

http://forum.whmcs.com/attachment.php?attachmentid=1238&stc=1&d=1261978031

 

i have read some where that i should replace the fonts with tcpdf UTF-8 fonts. but i didnt find anything specific about it . every where they just said that tcpdf is compatible with utf-8. and the samples worked fine . :( i dont know why whmcs cannot work correct.

Link to comment
Share on other sites

the strange thing is that for arabic/persian utf8 characters it brings square or ? instead of characters.

i have downloaded the latest tcpdf , and replaced the font files but no changes.

then i tried the samples of tcpdf and found that if the text on the source of the page being readable then it generates a good pdf.

so i have converted my database from latin to UTF-8.

now my data in the pages are correctly readable , and the data in the database is also readable in phpmyadmin :D and everything is UTF-8. but when i generate a pdf file still it brings squares.

 

i tried changing the fonts to the following fonts that works fine for arabic/persian characters. zarbold,almohanad,dejavusans. but i think whmcs do not use them at all!

because after uploading those fonts to the includes\fonts dir , and setting the font nam ein the invoicepdf.tpl,

// set font

$pdf->SetFont('dejavusans', '', 12);

 

still it shows squares. i have deleted fonts from my ftp . and it still shows squares ! i`m getting mad... :D

Link to comment
Share on other sites

here is what ive done. i have downloaded the latest tcpdf , and replaced the fonts in it with the fonts in includes\fonts. then tested and the results were the same.

then i have tested examples of tcpdf and saw that if the text on the source of the file being readable then it generates a good pdf.

so i have converted my db from latin to utf-8.

now my data on the pages are correct and alsso the data in the db in phpmyadmin is readable :D so everything is now UTF-8. but still pdf generates squares.

Link to comment
Share on other sites

here is what ive done. i have downloaded the latest tcpdf , and replaced the fonts in it with the fonts in includes\fonts. then tested and the results were the same.

then i have tested examples of tcpdf and saw that if the text on the source of the file being readable then it generates a good pdf.

so i have converted my db from latin to utf-8.

now my data on the pages are correct and alsso the data in the db in phpmyadmin is readable :D so everything is now UTF-8. but still pdf generates squares.

 

i think that it dont read the font files at all , i have defined the fonts in invoicepdf.tpl

// set font

$pdf->SetFont('dejavusans', '', 12);

i have tested the fonts that work fine on arabic like bzarbold and almohanad , i have double checked everything but results were the same.

what should i do ?

Edited by LAZer414
Link to comment
Share on other sites

hi i have finally solved the square and ? problem :D

it was because of the fonts . after converting the db to utf-8 and the files to utf-8 without bom , and uploading new fonts , we should set utf-8 fonts .

 

the fonts in tpl file did not run because they were defind in includes\tcpdf.php

function SetFont , by changing the fonts family to my required fonts , it worked :D

 

thank u all.

Link to comment
Share on other sites

  • 1 month later...

WHMCS version 4.1.2

 

Title and Creator are set automaticaly from WHMCS with your company name and invoice + number for the title. If you want to have keywords and a subject.

 

Go to whmcs/includes/tcpdf.php and search for

 

var $subject = '';

var $keywords = '';

 

and replace with your needs.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
hi i have finally solved the square and ? problem :D

it was because of the fonts . after converting the db to utf-8 and the files to utf-8 without bom , and uploading new fonts , we should set utf-8 fonts .

 

the fonts in tpl file did not run because they were defind in includes\tcpdf.php

function SetFont , by changing the fonts family to my required fonts , it worked :D

 

thank u all.

 

can you give me files after edit

 

thanks

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