Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-23-2007, 01:39 PM
Junior Member
 
Join Date: Sep 2007
Posts: 2
Default Pdf & utf8 - bug or not?

Hi,

I have problems with write UTF-8 strings in russian language, for ex. "Русский язык") to PDF file - some chars are not processed.

Notice: iconv() [function.iconv]: Detected an illegal character in input string in ...library/Zend/Pdf/Resource/Font.php on line 522


A similar problem has been here:
PDF file with UTF-8 string

Therefore, ask again:
Please, how can I generate PDF file from UTF-8 strings with national characters?

thanks.

Last edited by tim4dev : 10-23-2007 at 01:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-03-2007, 09:33 AM
Junior Member
 
Join Date: Dec 2007
Posts: 1
Lightbulb

I use this and work well:
$text = utf8_encode("é, ó, ññ ");
$page->drawText($text, '100', '200');

I Hope that it helps you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-07-2008, 12:56 PM
Junior Member
 
Join Date: Mar 2008
Posts: 1
Default similar Problem

Hey, I've got a smiliar Problem!

I want to export chinese words, but none of them are beeing shown in the pdf-document.

The reason is, that the included font-types don't support those special chars.

Is this a bug or where can I get FREE and WORKING font-types?

The best would be, if they'd work for all languages, but "ARIAL UNICODE MS" for example makes ZEND FRAMEWORK throwing an Exception...

Any Ideas???

ZF-Version is 1.5 RC1

The Exception-warning


Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Attempt to move beyond end of data source' in /daten/webserver/php-lib/Zend/Pdf/FileParserDataSource.php:183 Stack trace: #0 /daten/webserver/php-lib/Zend/Pdf/FileParserDataSource/File.php(176): Zend_Pdf_FileParserDataSource->moveToOffset(24131012) #1 /daten/webserver/php-lib/Zend/Pdf/FileParserDataSource.php(202): Zend_Pdf_FileParserDataSource_File->moveToOffset(24131012) #2 /daten/webserver/php-lib/Zend/Pdf/FileParser.php(209): Zend_Pdf_FileParserDataSource->skipBytes(16) #3 /daten/webserver/php-lib/Zend/Pdf/FileParser/Font/OpenType.php(393): Zend_Pdf_FileParser->skipBytes(16) #4 /daten/webserver/php-lib/Zend/Pdf/FileParser/Font/OpenType.php(120): Zend_Pdf_FileParser_Font_OpenType->_parsePostTable() #5 /daten/webserver/php-lib/Zend/Pdf/FileParser/Font/OpenType/TrueType.php(80): Zend_Pdf_FileParser_Font_OpenType->parse() #6 /daten/webserver/php-lib/Zend/Pdf/Font.php(747): Zend_Pdf_FileParser_Font_OpenType_TrueType->parse() #7 /daten/webserver/php-lib/Zend in /daten/webserver/php-lib/Zend/Pdf/FileParserDataSource.php on line 183
:

Last edited by Anybody : 03-07-2008 at 02:29 PM. Reason: Exception-Warning added
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-24-2008, 11:28 AM
Junior Member
 
Join Date: Mar 2008
Posts: 7
Default

Quote:
Originally Posted by mclalfaya View Post
I use this and work well:
$text = utf8_encode("é, ó, ññ ");
$page->drawText($text, '100', '200');

I Hope that it helps you.
You helped me by putting me on the right track .
I'm in an utf8 environment so a slight adjustment works for me:
code):
Code:
$text = "æøå ÆØÅ";
$page->drawText($text,100,200,"UTF-8")
Quote:
Originally Posted by Anybody View Post
Hey, I've got a smiliar Problem!

I want to export chinese words, but none of them are beeing shown in the pdf-document.

The reason is, that the included font-types don't support those special chars.
I'm not entirely sure but I guess you would get a truetype font put in a directory on your server (say 'www/fonts/my-special-font.ttf').
Then you create a font like this: (use the fontWithPath() method).
This worked for me.
Code:
$my_font = Zend_Pdf_Font::fontWithPath('www/fonts/my-special-font.ttf');

Last edited by fsando : 03-24-2008 at 12:35 PM. Reason: Found errors
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-24-2008, 02:54 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 112
Lightbulb

Quote:
Originally Posted by Anybody View Post
I want to export chinese words, but none of them are beeing shown in the pdf-document.

The reason is, that the included font-types don't support those special chars.

ZF-Version is 1.5 RC1
First, I recommend upgrading to the final 1.5 release. 1.5.1 is almost upon us, and it will pay to be up to date on this branch.

If you haven't seen this, check out the Zend_PDF part of the docs where it talks about fonts: Zend Framework: Documentation

You can use any font you want, provided you stay with in the supported font types (TTF Type 1 is the most universal).

If you know of a font that falls within the guidelines on the docs, and that you have available to you - just copy it to your project, and provide the full path to it when you call Zend_Pdf_Font::fontWithPath()

HTH
__________________
- xentek
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-23-2008, 03:58 AM
Junior Member
 
Join Date: May 2008
Posts: 1
Smile chinese font question

Quote:
Originally Posted by xentek View Post
First, I recommend upgrading to the final 1.5 release. 1.5.1 is almost upon us, and it will pay to be up to date on this branch.

If you haven't seen this, check out the Zend_PDF part of the docs where it talks about fonts: Zend Framework: Documentation

You can use any font you want, provided you stay with in the supported font types (TTF Type 1 is the most universal).

If you know of a font that falls within the guidelines on the docs, and that you have available to you - just copy it to your project, and provide the full path to it when you call Zend_Pdf_Font::fontWithPath()

HTH
HI, xentek!
I've got a question about chinese word too!

When I use Zend_Pdf_Font::fontWithPath('www/fonts/my-special-font.ttf') to embed chinese font into Pdf-document,
it can normally shown , but the File-size become very big.

Any way can I subset embed or don't embed , but let my char normally output ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-01-2008, 01:58 PM
Junior Member
 
Join Date: Jul 2008
Location: Canada
Posts: 5
Default chinese characters in PDF - same problem...

I have the same problem with chinese characters... The font weights 15 meg so I can not embed it in the document.

I posted question about that in another thread.

I am really not sure there is a solution so I considered either create a TTF myself containing only the characters I use.
Or render the typo in images and embed the images in the PDF.

If anybody has a solution it would save my life
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:28 PM.