Jump to content
Sign in to follow this  
imop

PDF and UTF-8 charsets

Recommended Posts

I`m testing this contribution http://addons.oscommerce.com/info/5321, it`s for PDF invoices. If all will be good i`ll add it to my shop!

 

 

But i came up with a problem for my language (Latvian - ē ū ī ā š ķ ļ etc.) special charters. So i have searched forum for answers, but got only questions and no good solution for it!

 

This contribution is using FPDF as i understood it`s dose not support UTF-8, so i have made my research and find that UFPDF is the answer on my question, but the main problem is that as i`m not a programmer, but i understand how this works, can someone help me to solve this, how to replace FPDF with UPDF.

 

 

Can someone give me a clue or point to right direction or best way supply with already fixed solution!

 

Thanks!


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

Anyone?


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

I don't have this contribution installed, so I can not say much. Taking a quick look, I found in file pdfinvoice.php following line

	$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")),0,'L');

 

like for everything that is getting printed.

 

I can not tell you how to solve this, but this is causing the error

Share this post


Link to post
Share on other sites

I don't have this contribution installed, so I can not say much. Taking a quick look, I found in file pdfinvoice.php following line

	$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")),0,'L');

 

like for everything that is getting printed.

 

I can not tell you how to solve this, but this is causing the error

 

 

i`ll try to figure out why it`s so but i have i clue! :)


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

Hope you will post the results here :)

 

 

if i get that i will! ;)

 

p.s. we need to share our knowledge! :)


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

if i get that i will! ;)

 

p.s. we need to share our knowledge! :)

 

 

I have trying to combinate FPDF and UFPDF, but can`t get it work, maybe someone hve done it?


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

I have trying to combinate FPDF and UFPDF, but can`t get it work, maybe someone hve done it?

 

Can you post exactly what you was trying to do and what the results are? Will be easier for somebody else to jump in

Share this post


Link to post
Share on other sites

After two sleepless nights (and a ton of smoked cigarettes - just kidding) I finally came up with a solution.

 

I had installed PDF invoice and Pslip with FPDF. I downloaded TCPDF. I copied tcpdf.php in fpdf directory and renamed it in fpdf.php. I copied all the .php files in tcpdf directory to fpdf dir. I also copied the config and the fonts directory to fpdf directory. Then I changed the pdfinvoice.php (around line 125)

 

class PDF extends FPDF

in

class PDF extends TCPDF

 

then I Setting up a Verdana font for usage with TCPDF (described in the Utils folder) [if you need help with changing the fonts, just ask]. upload it to the fonts directory.

 

in tcpdf.php (or now renamed fpdf.php) I replaced all the source codes courier with verdana. and that's it...now I have Croatian special characters [šđč枊ĐČĆŽ]

Share this post


Link to post
Share on other sites

After two sleepless nights (and a ton of smoked cigarettes - just kidding) I finally came up with a solution.

 

I had installed PDF invoice and Pslip with FPDF. I downloaded TCPDF. I copied tcpdf.php in fpdf directory and renamed it in fpdf.php. I copied all the .php files in tcpdf directory to fpdf dir. I also copied the config and the fonts directory to fpdf directory. Then I changed the pdfinvoice.php (around line 125)

 

class PDF extends FPDF

in

class PDF extends TCPDF

 

then I Setting up a Verdana font for usage with TCPDF (described in the Utils folder) [if you need help with changing the fonts, just ask]. upload it to the fonts directory.

 

in tcpdf.php (or now renamed fpdf.php) I replaced all the source codes courier with verdana. and that's it...now I have Croatian special characters [šđč枊ĐČĆŽ]

 

 

This is really fantastic!!

 

Can send me thous fonts u used - Verdana?


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

look in PM's

 

 

I have found time for testing your theory, but i have an error when i try make an PDF

 

this is the error:

 

TCPDF ERROR: Could not include font definition file: arial

 

But cant find any arial in new fpdf.php


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

Share this post


Link to post
Share on other sites

I have found time for testing your theory, but i have an error when i try make an PDF

 

this is the error:

 

TCPDF ERROR: Could not include font definition file: arial

 

But cant find any arial in new fpdf.php

 

 

Stuid me! :P

 

Got it solved, i did not have any arial fonts on my server, so i made them and then it all worked perfectly!

 

p.s. for thous who are asking about the last command of making font - php -q makefont.php myfont.ttf myfont.ufm

 

This is need to be executed from Telnet client such as Putty! just copy your files to the server and have fun! (This took a while for me to understand!)

 

Cheers!


1) Backup before you make changes on osC.

2) Backup between addon installs on osC.

 

p.s. Usually you can meet me in osC chat for free help and advice ;)

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  

×