# PDF Invoice Pro

Thanks for purchasing our product, we hope it will fulfil all your requirements and expectations.

## Installation

This module does not affect critical parts of opencart, so it is not necessary to make backup before installing.
If you have any problem after installing the module, just disable the vqmod/ocmod modification and contact us.

VQMOD or OCMOD ?
- OCMOD is the modification system integrated since opencart 2.0, use this version if you have opencart 2.0+ and don't have VQMOD installed.
- VQMOD is the modification system used on opencart 1.5 but that is still working on 2.x and 3.x, VQMOD is generally better on module compatibility, so if you have it better use VQMOD version of the module.
VQMOD is not integrated in opencart by default, you will have to install it (using Easy VQMOD Installer for example).

### Installation procedure - OCMOD (opencart 2.x and 3.x)

Because of limit in length of ocmod modification when stored in sql, the ocmod modification file is put in /system directory, so you won't find it in modifications list but you will have to refresh modifications anyway, if you want to disable it you can rename the modification file to .xml_ (and refresh again)

There is 2 installation packages, the main one and "libraries", you need to install both.
Once libraries is installed you will just have to update main package in case of new version of the module.

In main package you will find other useful files, like compatibility patches, extra languages, theme patches...

Install via Extension installer

On OC 3.x the extension installer is very limitating and does not allow to write in some folders, if you have a warning uppon installation about that just follow the FTP installation procedure.

- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.ocmod.zip)
- Download the libraries package on your desktop (pdf_invoice_libraries_v1.X.ocmod.zip)
- Go to Extensions > Extension installer and upload both packages
- Go to Extensions > Modifications and push the refresh button (the module does not appear in the list)
- Go to Extensions > Modules, and click on install button
- Optionnal: you can also install PHPMailer package using same procedure, it fixes opencart issues with attachments on some IOS devices

Install via FTP

- Use this if for some reason you can't install via extension installer (timeout, max upload file size)
- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.ocmod.zip)
- Download the libraries package on your desktop (pdf_invoice_libraries_v1.X.ocmod.zip)
- Copy content of the "upload" folder of each package into the opencart root folder of your FTP
- Go to Extensions > Modifications and push the refresh button (the module does not appear in the list)
- Go to Extensions > Modules, and click on install button
- Optionnal: you can also install PHPMailer package using same procedure, it fixes opencart issues with attachments on some IOS devices

### Installation procedure - VQMOD (opencart 1.5 to 3.x)

Install via FTP

- If vqmod is not yet installed, install this Easy VQMOD Installer package
- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.vqmod.zip)
- Download the libraries package on your desktop (pdf_invoice_libraries_v1.X.vqmod.zip)
- Copy content of the "upload" folder into the opencart root folder of your FTP
- Go to Extensions > Modules, and click on install button
- Optionnal: you can also install PHPMailer package using same procedure, it fixes opencart issues with attachments on some IOS devices

### Update procedure

Update is very easy, it is not necessary to uninstall the module before proceed.

Update OCMOD version via Extension installer

- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.ocmod.zip)
- Go to Extensions > Extension installer and select the module package
- In Extensions > Modifications, push the refresh button

Update OCMOD version via FTP

- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.ocmod.zip)
- Copy content of the "upload" folder into the opencart root folder of your FTP
- Go to Extensions > Modifications, activate the corresponding module modification, and push the refresh button

Update VQMOD version via FTP

- Download the module package on your desktop (pdf_invoice_pro_vX.X.X.vqmod.zip)
- Copy content of "upload" folder into the opencart root folder

### How to switch between vqmod and ocmod versions?

- Delete the file /vqmod/xml/[module_name].xml (or rename to .xml_)
- Download ocmod package and upload the file /system/[module_name].ocmod.xml to your system folder
- In Extensions > Modifications, push the refresh button
- To switch from ocmod to vqmod just do the reverse operation

### You have a customized admin folder (VQMOD only)?

- Open the file /vqmod/pathReplaces.php in a text editor (like notepad++)
- add a line: $replaces[] = array('~^admin\b~', 'my_custom_admin');

## Usage

### Proforma/Invoice

By default, the module will generate a Proforma Invoice until the invoice number is created.

That means that if you want to edit or insert manually the invoice number, if you allow the module to send the Invoice before to create the invoice number, your clients will receive a Proforma Invoice until you edit the invoice number (if you choose to allow auto invoice number, you will never send any Proforma Invoice, it will always be a normal Invoice).

If you want to change this default behavior, you just have to change (or remove) the text by going in the language file /catalog/language/*/module/pdf_invoice.php
Change the value Proforma by Invoice and you will always send normal Invoice, with or without invoice number.

### Wording change

The words used in this module are the most used for the invoicing process. However, if you neeed to change any value of the pdf file (like "invoice" or "VAT id", etc.), you can do it by going in the language file /catalog/language/*/module/pdf_invoice.php

You could also need to change some values of the module (for example, the pdf print link created on the order information page). In the same way, you can change any value in the language file of the module.

### Change date format

You can change the date format by editing the language file /catalog/language/*/module/pdf_invoice.php

Search for "pdf_date_format" and adapt the value corresponding your needs, for example: %m/%d/%Y for mm/dd/YYYY, %d/%m/%Y for dd/mm/YYYY.

See all available values here: http://php.net/strftime.

### Languages

##### Work with multi languages

Here is the way to work with multi languages:

- Check if your language is included in the module package, in extra languages/ folder.
- If it doesn't exist, just copy the english file and open it to translate it.
- Copy pdf_invoice.php language file into /catalog/language/xxxxxx/module/.

If you want, we integrate your language in the main package, just send us back your language file.

##### RTL language

To work with RTL language, you must adapt the value of "direction" into the language file. You have to go into \catalog\language\*\module\pdf_invoice.php and change this value: $_['direction'] = 'ltr';

If you built your own rtl language file, some numbers like the total could be displayed in the wrong way. In this case, please go in the file /catalog/language/arabic/default.php you may have $_['thousand_point'] = ' '; change it to $_['thousand_point'] = '';
It should fix your problem.

##### Customized language file

If you work with your own customized language file (or if you want to customized the default file), you might want to change the decimal and thousands separator. In this case, please go in the language file /catalog/language/*/module/pdf_invoice.php and change these values at your convenience:
$_['decimal_point'] = '.';
$_['thousand_point'] = ',';

### Customized template

##### Customize the PDF template

To customize the PDF template, duplicate a file in /catalog/view/theme/default/pdf/ folder and edit the html as you wish.

If you want to directly change the default template, open this file /catalog/view/theme/default/pdf/default.tpl and make the change you want to make.
In the case you want to change the background image of the template, use the @page{} css section and make sure the path of your image is correct, the path is relative to Opencart root folder.

##### FAQ

When I save a template of a store, the colors change to black lines and black text. Everytime I change something, I must open a color delete and add the color again.

Make sure you don't have some other extension that is actually loading a js library related to a color picker directly on admin (instead of only the concerned module).
If you have that, ask the autor of this extension to not load libraries over the whole admin because it generates conflicts with other modules.

### Problem with the PDF file

There is no pdf invoice attached to emails

Various possibilities:

- You have some PHPMailer installed : can be /vqmod/xml/PHPMailerV2.xml or on v2 check in modifications, please disable/delete it, it does not handle attachments (or ask dev to make it handle attachments), use instead my own implementation of phpmailer, included in last libraries package.
- You have some custom email template module, or one page checkout module, the module is natively compatible with professional email template, quick checkout and others, and there is a patch for status email template. Contact me if you use another one.

I have some "?" chars in the pdf

Encode your language files (/catalog/language/*/module/pdf_invoice.php) in UTF-8 without BOM.

The PDF output displays partially

It is generally caused by an unclosed html tag, on titles for payment or shipment which are too long to be saved completely in database.

- Check if you have a payment or shipment that includes a logo inside title.
- Reduce the text size of this title to max 128 chars.
- Fix old entries in database (can be one of these ones depending the case):
  - table order, field payment_method
  - table order, field shipping_method
  - table order_total, field title

When I save, transparent colors is set to white

This is a conflict with jscolor library, it means you have a module who loads jscolor at anytime, even when it is not required.
Please contact the developer of this extension and ask him to make the includes only where it's for use.
Problem seen on this extension : dbassa_adca_intelligent_product_labels.xml.

Invoices are not auto generating and not send as attachment to customers

If you installed ocmod version, make sure you clicked on Extension > Modification > Refresh button.

##### PDF icon

The dowload pdf icon is not displayed in user account section (order list or order detail).

- The theme integration is managed by a separate file located at /vqmod/xml/pdf_invoice_pro_default_theme_2.0.xml.
- If this one is not compatible with your theme first check in the folder extra theme support if there is a file corresponding to your theme.
- 2.0 theme included by default, if you are on 1.5.x, try first to use the file pdf_invoice_pro_default_theme.xml.
- Put the choosen theme xml file into /vqmod/xml/ and delete the previous pdf_invoice_pro_default_theme_2.0.xml (only one theme xml must be present).
- If there is not your can customize the default one, or contact us, we will make the patch for you.

How to insert new icons ?

Just upload your icon in the folder /image/invoice/, your icon will automatically appear in admin section so you can select it.

##### Logo

The logo have some glitches on the pdf

Sometimes the png images with transparent background renders bad, just make a version with white background to solve this problem.

Why my logo looks smaller on invoice than store's one ?

We set a resolution of 150dpi for invoice images in order to keep them at good quality for print, if you want a bigger one you should use a 150dpi version of your logo.

### Apple devices

PDF file attachment on apple devices (little icon after the mail or unable to open file)

Some apple devices doesn't handle well one-page pdf attachments, it tries to display it into mail body. This can be solved by selecting in the app to display attachment as icons instead of inline.
There is nothing else to do! No workaround exists actually, please give the thanks to apple...

### Other

Where can I change my company name (wich is on invoice pdf)?

The company name is in System > Settings > Store > Store name.

How to show shiping price without VAT above sub-total value?

Make sure that the option "Tax in totals" is set to none, otherwise it will include taxes into it.

## FAQ General

500 internal server error on generating pdf

Open the file /system/library/mpdf/mpdf.php and comment these 3 lines (add double slashes // at start of each line):

- header('Content-Type: application/octet-stream', false);
- header('Content-Type: application/download', false);
- header('Content-Type: application/pdf', false);

Duplicate modifications - Google Marketing tools

Google Marketing tools module and maybe some others are modifying core opencart modification system, the implementation is badly made and breaks some modifications, you can see if you have that if you find the file:
- /admin/controller/extension/installer.php.original
- /admin/controller/extension/modification.php.original
If you have these 2 files you should restore them and contact the author of the module who made this to tell him it is not working well.

mPDF error: Some data has already been output to browser, can't send PDF file

Make sure that you encoded the language files in "utf-8 without BOM".
Example with notepad++ :

- Open the file /catalog/language/xxx/module/pdf_invoice.php.
- Menu > Encoding > Convert to UTF-8 without BOM.
- Save file.

Blank page in admin or "Undefined index: en in /admin/controller/module/pdf_invoice.php"

Cache problem on opencart v1.5.1. Delete the file /system/cache/cache.language.XXXXXXXXX and reload the page.
Note: should be fixed in last versions.

Error : "HTML contains invalid UTF-8 character(s)"

Encode your language files (/catalog/language/*/module/pdf_invoice.php) in UTF-8 without BOM.

Error : Directory containing files to be uploaded could not be found!

Try to ftp the contents of the core files that is inside the "upload" folder to the root of the opencart. After you have uploaded it, then go to admin page of opencart and click on modifications and click on refresh.

Warning: file_put_contents(/system/library/mpdf/ttfontdata/garuda.GSUBGPOStables.dat) [function.file-put-contents]: failed to open stream: Permission denied in /system/library/mpdf/classes/ttfontsuni.php on line 999

Try to set permissions on ttfontdata/ folder to 777.
Also make sure you have free space on your server.

When I try to install the "libraries" package via extension installer", I got error: File could not be uploaded.

If library package can not be uploaded through extension installer, you just have to upload it directly on ftp.

Why toast falls butter side down ?

Can't solve this one dude ! :]

## FAQ Mijoshop

Install extra languages for the module

Make sure that you encoded the language files in "utf-8 without BOM"
Example with notepad++ :

- Open the module zip file, and check in "_extra languages" folder if the language you need exists.
- Copy it into /components/com_mijoshop/opencart/catalog/language/.
- Important: rename the language folder with the locale (example: /components/com_mijoshop/opencart/catalog/language/dutch/ to /components/com_mijoshop/opencart/catalog/language/nl-NL/).
  You can find the good locale name in the joomla folder : /language/.

## Support

For any problem or feature request, feel free to contact us at support@geekodev.com

You may also be interested in these best selling modules :

- SEO modules: Complete SEO Package - Multilingual SEO
- Pro Email Template
- Quick Order Status Updater