1
SMEDrieben
UTF-8 and PDF-generation
  • 2010/2/6 20:10

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


I open this new thread for 2 reasons:

- there is a general recommendation to convert to UTF-8
- UTF-8 doesn't work correctly with pdf-generation and RSS

This thread: pdf-generation:

1) There is a thread on this topic. However, this thread is on pdf.php of the news-module.

2) The news module has 2 ways to generate pdf's: pdf.php and makepdf.php (FPDF 1.53). Smartsection also uses makepdf.php (FPDF 1.52). There are no forum data to adjust makepdf.php to UTF-8 use.

I converted my site to UTF-8. Can anybody help me to adjust makepdf.php for use with UTF-8 ?

Thanks !

SME Drieben


2
dnprossi
Re: UTF-8 and PDF-generation
  • 2010/2/8 9:39

  • dnprossi

  • Not too shy to talk

  • Posts: 107

  • Since: 2006/3/15


hi SMEDrieben,

here is a link to my configuration files for utf-8 pdf using tcpdf.
included in xoops-news-tcpdf-utf8.zip are the makepdf file and new tcpdf_config with some corrections so that also images work and urls are parsed correctly.
There is also xlanguage support stuff and simple chinese fonts and solution but it should not cause any problems if not using them.

for demo of utf8-pdf working go here
select a language read a news and click pdf icon...

and to download zip go here

hope it helps...

3
SMEDrieben
Re: UTF-8 and PDF-generation
  • 2010/2/10 15:02

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


Thanks for your help.

Unfortunately it did not work. Both the special characters were not correct using your makepdf and the image tags remained disturbing the format.

However, I solved the problem in News in another way. I used the thread I mentioned above and added three lines to pdf.php:

$content str_replace('[pagebreak]','
'
,$content);  //after this line
$pattern[] = "//sU";
$replacements[] = '';
$content preg_replace($pattern$replacements$content);


Now the images are deleted, the text is perfect !!

SME Drieben

4
dnprossi
Re: UTF-8 and PDF-generation
  • 2010/2/15 11:18

  • dnprossi

  • Not too shy to talk

  • Posts: 107

  • Since: 2006/3/15


Hi SME Drieben,

Sorry I had not understood problem.

I found an issues in modules/news/pdf/config/tcpdf_config.php
the XOOPS root images directory is missing a slash

is:
define ('K_XOOPS_PATH_IMAGES'XOOPS_ROOT_PATH.'images/');

Shold be:
define ('K_XOOPS_PATH_IMAGES'XOOPS_ROOT_PATH.'/images/');


This should fix '' tag problem so you have images appear again

INFO: XOOPS tags are not recognized by TCPDF eg
[img][/img]


In the zip file mentioned above there is also corrected tcpdf_config.php

Let me know if it helps...

P.S. above topic, thread is not pdf topic...

5
SMEDrieben
Re: UTF-8 and PDF-generation
  • 2010/2/17 20:20

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


Thanks for the help !

Unfortunately, it doesn't work.

First, in tcpdf_config.php the line you mentioned, doesn't exist (I am on News 1.64 and tcpdf.php 4.1.000)

I have this line:

define ("K_PATH_IMAGES"K_PATH_MAIN."images/");


and changed it to

define ("K_PATH_IMAGES"K_PATH_MAIN."/images/");


This doesn't make any difference: the images disturb the pdf and the lines are printed over each other.

If you have any further suggestions, I'm curious the read them.

Thanks,

SME Drieben

Login

Who's Online

346 user(s) are online (282 user(s) are browsing Support Forums)


Members: 0


Guests: 346


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits