The Joomla! Forum ™






Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 87 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Fri Nov 03, 2006 8:10 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
As it was announced on myjoomla.gr yesterday, this problem has been fixed for Joomla! 1.0.x. Here's how:

1. Download the appropriate version of TCPDF for the php version used by your server (either 4 or 5).

2. Decompress the downloaded file in the includes/ folder. Rename the new folder tcpdf (if it's not already called so).

3. Correct the installation and URL path in includes/tcpdf/config/tcpdf_config.php like so:

Code:
define ("K_PATH_MAIN", "path_to_your_joomla/includes/tcpdf/");
define ("K_PATH_URL", "url_to_your_joomla/includes/tcpdf/");


4. Download the attached Greek language file to display e.g. "Page 1/12" in Greek at the bottom of each page (an English language file is installed by default and new translations can be added as needed). Install it in folder tcpdf/config/lang.

5. Rename path_to_your_joomla/includes/pdf.php into path_to_your_joomla/includes/pdf.php.bk

6. Download the attached modified pdf.php and copy it to path_to_your_joomla/includes/.

7. Change the following variables as needed in file pdf.php

Code:
/************************ Start editing here ************************/

   $lang =       'el';            // Language (change it to eng for English)
   $enc =          'UTF-8';         // Encoding
   $unit =       'mm';            // Unit of measurement
   $format =       'A4';             // Page format
   $orient =       'P';             // Page orientation
   $fnt =          'FreeSerif';               // Font name
   $size =       10;             // Font size
   $mrgleft =       20;            // Left margin
   $mrgright =            20;            // Right margin
   $mrgtop =       40;            // Top margin
   $mrgbottom =            30;            // Bottom margin
   $mrghead =       20;            // Header margin
   $mrgfoot =       20;            // Footer margin
   $scale =       1;            // Image scale factor

/************************ Stop editing here ************************/


8. That's it! Enjoy unicode-friendly pdf files but don't forget to install fonts as needed in the url_to_your_joomla/includes/tcpdf/fonts/ folder.


This hack has been tested on php4 and php5. Images do not seem to be incorporated in the produced pdf files with php5 and there seems to be a problem with wide tables.

Any suggestions or bug reports are highly appreciated and, if possible, should be cc'ed to the creator of TCPDF.


You do not have the required permissions to view the files attached to this post.


Last edited by infograf768 on Sat May 26, 2007 5:20 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Nov 03, 2006 8:13 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Aug 18, 2005 10:41 am
Posts: 15753
Hi,

At first glance this looks really good. I'll be trying this hack/patch myself, thanks for posting it.

Regards Robin

_________________
Regards Robin

http://www.linkedin.com/in/robinmuilwijk - http://twitter.com/i_robin


Top
 Profile  
 
PostPosted: Sat Nov 04, 2006 5:37 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17396
Location: **Translation Matters**
tcpdf is indeed the solution used in Joomla 1.5, thanks to davidgal.
See libraries/tcpdf  ;)

I will test this too on a utf8 site.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Nov 04, 2006 8:16 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
infograf768 wrote:
tcpdf is indeed the solution used in Joomla 1.5, thanks to davidgal.
See libraries/tcpdf  ;)


True! I just checked it out!  :)

I thought (and, unfortunately, wrote so to the creator of TCPDF, Nicola Asuni) that the Joomla! team was developing their own solution to the unicode-pdf problem for the upcoming 1.5 version. It seems that Nicola was also unaware of this development.

For those Joomla! users who don't have a local web site set up for testing purposes, you can see how well TCPDF integrates with Joomla! 1.0.11 and php4 here (picture included) and here (wide table problem).


Top
 Profile  
 
PostPosted: Thu Apr 19, 2007 3:44 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Apr 19, 2007 3:27 pm
Posts: 4
Many thanks to you.
This really works and you helped me a lot.


Top
 Profile  
 
PostPosted: Fri Apr 20, 2007 11:39 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat May 20, 2006 10:02 am
Posts: 322
Location: Hà thành
Good solution!

But the pdf is very BIG, about 700Kb for only 2 pages without images!

_________________
http://kythuatvatlieu.org
http://kulkul.luyenkim.org
The 1st Vietnamse Portal in Metallurgy and Materials Technology
Sắt thép, nhiệt luyện, cán kéo kim loại, thiêu kết, mô phỏng, thí nghiệm, kiểm tra vật liệu, vô định hình, đúc hợp kim, tinh luyện


Top
 Profile  
 
PostPosted: Mon Apr 23, 2007 3:58 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat May 20, 2006 10:02 am
Posts: 322
Location: Hà thành
I have two questions:
- How do we display image in case using {mosimage} in the content?
- How to make {mosPageBreak} also work for PDF file? I mean we also make a break page in pdf file!

Thanks.

_________________
http://kythuatvatlieu.org
http://kulkul.luyenkim.org
The 1st Vietnamse Portal in Metallurgy and Materials Technology
Sắt thép, nhiệt luyện, cán kéo kim loại, thiêu kết, mô phỏng, thí nghiệm, kiểm tra vật liệu, vô định hình, đúc hợp kim, tinh luyện


Top
 Profile  
 
PostPosted: Thu May 17, 2007 9:46 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Apr 19, 2007 3:27 pm
Posts: 4
viet4777 wrote:
- How do we display image in case using {mosimage} in the content?


I also had this problem and what i did was that i removed ability to insert {mosimage} and use WYSIWYG editor, that inserts images as links directly.

Another problem also exist - GIF images are not supported. If some topic contains gif image and you generate pdf, you simply get an error and not even a part of document (nor document without images)


Top
 Profile  
 
PostPosted: Fri May 25, 2007 9:21 pm 
I've been banned!

Joined: Thu Aug 25, 2005 2:33 pm
Posts: 1868
JM,
please stick the thread :)


Top
 Profile  
 
PostPosted: Sat May 26, 2007 5:21 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17396
Location: **Translation Matters**
Done. But I changed the Title as the hack is quite consequent.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Mon May 28, 2007 12:29 am 
I've been banned!

Joined: Thu Aug 25, 2005 2:33 pm
Posts: 1868
OK, improved version (easier):

1. Backup the file includes/pdf.php
2. Download
- This file, if you use php4
- This file, if you use php5
3. Unzip and upload to your Joomla! folder.

Note: You need to edit the includes/tcpdf/config/lang/english.php if you are using right to left language.

I am trying at the moment to make it load the language automatically, so no manual code inputs to be needed. After that I might consider to make it installable as a component. :)


Top
 Profile  
 
PostPosted: Sat Nov 03, 2007 1:19 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Nov 03, 2007 1:13 am
Posts: 3
I am having the same problem. I used the instruction give above but can't seem to change the title and diplay it in Unicode.

Any help is appreciated!

Thank you.


Top
 Profile  
 
PostPosted: Sat Nov 03, 2007 2:18 am 
I've been banned!

Joined: Thu Aug 25, 2005 2:33 pm
Posts: 1868
Please checkup if the problem is in your database first and not in the hack?


Top
 Profile  
 
PostPosted: Sat Nov 03, 2007 4:26 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Nov 03, 2007 1:13 am
Posts: 3
Apoligies, my problem is not Unicode PDF. It is unicode on title field. I guess I am on a wrong topic.

Thank you.


Top
 Profile  
 
PostPosted: Sat Nov 03, 2007 9:21 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
It's been since March 2007 that I offered this solution to the Greek Joomla! forum but I completely forgot to mention it here. Today I received a notification regarding the latest mesages so... here it goes:

  • Rename includes/pdf.php to includes/pdf.php.bk
  • Download TCPDF for Joomla! 1.0.x here.
  • Upload and decompress the file in the includes folder.
  • You are ready to go!

The file is a bit bulky because it contains both TCPDF versions for PHP 4 & 5. The appropriate php version is selected automatically and a few of TCPDF's configuration files have been tampered with, so there is no need for you to edit any other files apart from includes/pdf.php as proposed in the first post of this thread (of course, you can also translate and change the language file that's been loaded if you speak any language other than English or Greek).

The file is based on the latest TCPDF version, which has been slightly changed (actually, bent) to support .gif images apart from .jpg and .png, which were already fully supported. Support for {mosimage}, {mospagebreak} and {jumi} has also been added.

Enjoy!


Top
 Profile  
 
PostPosted: Mon Nov 26, 2007 9:41 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Nov 12, 2005 10:55 pm
Posts: 856
Location: Israel
Hi,
this is indeed a great solution to all the non-Latin languages, & it does work.
but there's a problem setting the PDF to display in RTL.

This issue is a problem to both 1.0.x & 1.5.x PDF's...

can anyone share a solution for this?

_________________
"In a world without walls and fences,
who needs Windows & Gates?"

http://www.smartmtk.com | http://www.lighthost.co.il/webhosting-for-joomla


Top
 Profile  
 
PostPosted: Mon Nov 26, 2007 1:25 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17396
Location: **Translation Matters**
TCPDF issue?

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Mon Nov 26, 2007 1:31 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Nov 12, 2005 10:55 pm
Posts: 856
Location: Israel
very probable...
but if so, we need a second plan for J!1.5

_________________
"In a world without walls and fences,
who needs Windows & Gates?"

http://www.smartmtk.com | http://www.lighthost.co.il/webhosting-for-joomla


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 3:44 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Wed Nov 28, 2007 3:22 pm
Posts: 93
Location: Belgrade, Serbia
This is great & work like a charm.
But can some one help me make custom footer message.
Would like to show domain name and email address.

Looked at pdf.php, but couldn't figure out where to put it.
Just a simple line of text.

Thanks!  :)

_________________
CEO & Lead Developer at WebHostLab
https://www.webhostlab.com


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 6:15 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
Change line 1443 (if you've got PHP5) or line 1436 (if you've got PHP4) in includes/tcpdf/tcpdf_php5/tcpdf.php or includes/tcpdf/tcpdf_php4/tcpdf.php respectively as follows:

Code:
$this->Cell(0, $footer_height, 'my message here!', 'T', 0, 'R');


Change the final 'R' to 'L', if you'd like to align your text to the left.

PS: Ah, yes! There is also 'C' for center.  ;)


Last edited by emav on Wed Nov 28, 2007 6:18 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 6:53 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17396
Location: **Translation Matters**
@MTK
If this works, would be good to find a way to change this parameter in 1.5.
Issue would be that ideally it should change on an article basis and not globally.
Not sure this would be possible for 1.5

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 7:09 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Nov 12, 2005 10:55 pm
Posts: 856
Location: Israel
As soon as, RTL issue is solved, I'll be more than happy to try & find the way to set this by template/language params...

_________________
"In a world without walls and fences,
who needs Windows & Gates?"

http://www.smartmtk.com | http://www.lighthost.co.il/webhosting-for-joomla


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 9:07 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Wed Nov 28, 2007 3:22 pm
Posts: 93
Location: Belgrade, Serbia
Thanks emav.
Work perfectly.  :)

_________________
CEO & Lead Developer at WebHostLab
https://www.webhostlab.com


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 9:15 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
mtk wrote:
Hi,
this is indeed a great solution to all the non-Latin languages, & it does work.
but there's a problem setting the PDF to display in RTL.

This issue is a problem to both 1.0.x & 1.5.x PDF's...

can anyone share a solution for this?


I started looking into this since you mentioned the problem. It never occured to me that it wouldn't work for RTL languages (actually, I never gave it a thought). Could you send me a sample text mixing Hebrew and/or Arabic with English to try and fix/hack the problem?

Maksin wrote:
Thanks emav.
Work perfectly.  :)


I'm always glad to help.  :)


Top
 Profile  
 
PostPosted: Wed Nov 28, 2007 9:22 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Nov 12, 2005 10:55 pm
Posts: 856
Location: Israel
sure, you need plain text here, or PDF on a file?

_________________
"In a world without walls and fences,
who needs Windows & Gates?"

http://www.smartmtk.com | http://www.lighthost.co.il/webhosting-for-joomla


Top
 Profile  
 
PostPosted: Tue Dec 04, 2007 9:27 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Wed Sep 20, 2006 7:48 pm
Posts: 344
Location: Tehran,Iran
emav wrote:
Change line 1443 (if you've got PHP5) or line 1436 (if you've got PHP4) in includes/tcpdf/tcpdf_php5/tcpdf.php or includes/tcpdf/tcpdf_php4/tcpdf.php respectively as follows:

Code:
$this->Cell(0, $footer_height, 'my message here!', 'T', 0, 'R');


Change the final 'R' to 'L', if you'd like to align your text to the left.

PS: Ah, yes! There is also 'C' for center.  ;)


Hello,
for rtl don`t work :-(

_________________
Joomfa Team(Joomla farsi) ==> http://joomfa.org


Top
 Profile  
 
PostPosted: Tue Dec 04, 2007 9:44 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
modern wrote:
Hello,
for rtl don`t work :-(


Watch out for a solution to the rtl problem by the end of the month. First tests look promising...  :)


Top
 Profile  
 
PostPosted: Tue Dec 04, 2007 9:58 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Wed Sep 20, 2006 7:48 pm
Posts: 344
Location: Tehran,Iran
http://mostafa.mosmar.com/blog/2007/05/ ... nd-joomla/

_________________
Joomfa Team(Joomla farsi) ==> http://joomfa.org


Top
 Profile  
 
PostPosted: Tue Dec 04, 2007 10:17 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Nov 03, 2006 7:39 pm
Posts: 58
Location: Thessaloniki, Greece
Great analysis, Mostafa (?).

I followed the same methodology more or less when the rtl problem was first reported and came against the bottom-lines-up issue you mentioned. So, I gave that up and started modifying the pdf file that's finally produced by TCPDF. This seems to solve the problem at the source. Maybe we could merge the two projects together once I'm finished hacking away to solve this issue effectively and quickly.


Top
 Profile  
 
PostPosted: Wed Dec 05, 2007 8:53 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Nov 12, 2005 10:55 pm
Posts: 856
Location: Israel
Emav,
can you please try & keep your hack to TCPDF as long as possible?
This way we could merge it easily for J!1.5...

_________________
"In a world without walls and fences,
who needs Windows & Gates?"

http://www.smartmtk.com | http://www.lighthost.co.il/webhosting-for-joomla


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 87 posts ]  Go to page 1, 2, 3  Next



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group