everytime I try to convert a UTF8 text I get questionsmarks except of ... The standard character encoding options in PDF only support a
GroupsdompdfConversationsLabelsAboutUTF-8Problem2821viewsSkiptofirstunreadmessageShamharothunread,Mar22,2010,11:57:25PM3/22/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfHiIamtryingtoconvertHTMLtoPDFoverC++(withpipetophp)andeverytimeItrytoconvertaUTF8textIgetquestionsmarksexceptofmylocalumlaute(thetypicalgerman"äöüß")andsoonwhenItrytoconvertsignslike"€"theywillbechangedwith"?",too.ThedatawhichtheC++-programsendstothephp-scriptoverthepipearenormal(ImadeaoutputtotheconsoleandtheanswerIgot(thenormalconsoleprintistheUTF8signs"ąčęėįšųūž"...sothecommunicationbetweenmyprogramandthescriptisok.Somyquestion:HowcanIcreateaUTF-8-PDF?ItriedthestabilversionandsoonItrieditwiththenewestBeta.thankingyouinanticipationramoncastroperezunread,Mar23,2010,12:31:03AM3/23/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodom...@googlegroups.comWithPHPIusethefunction:"utf8-decode()"2010/3/22Shamharoth
--
YoureceivedthismessagebecauseyouaresubscribedtotheGoogleGroups"dompdf"group.
Toposttothisgroup,[email protected].
Tounsubscribefromthisgroup,[email protected].
Formoreoptions,visitthisgroupathttp://groups.google.com/group/dompdf?hl=en.
--RamónCastrohttp://ramoncastro.es
BrianSunread,Mar23,2010,1:15:55AM3/23/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfEvenwiththeupcomingreleasetherearesomelimitationincharactersupport.ThestandardcharacterencodingoptionsinPDFonlysupportalimitednumberofcharactersoutofthebox.DOMPDFcurrentlyonlysupportsoneoftheseencodings,whichisasubsetofWindowsANSI.IfyouattempttousethecorePDFfontsyou'llrunintotheproblemyounoted.ThecurrentrecommendedmethodtoworkaroundthislimitationinDOMPDFisto"install"afontandenableUnicodesupport.Shamharothunread,Mar23,2010,4:01:16PM3/23/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfAtfirstthxforyouranswers>WithPHPIusethefunction:"utf8-decode()"Itriedthefunctionutf8_decode()butmythefirstpartoftheteststringwasdeleted(teststring:>öäü߀ÄÖÜ
>öäüßÄÖÜ
>ąčęėįšųūžtheöareahtml-codefüröandsoon)>Evenwiththeupcomingreleasetherearesomelimitationincharacter>support.ThestandardcharacterencodingoptionsinPDFonlysupporta>limitednumberofcharactersoutofthebox.DOMPDFcurrentlyonly>supportsoneoftheseencodings,whichisasubsetofWindowsANSI.If>youattempttousethecorePDFfontsyou'llrunintotheproblemyou>noted.>>Thecurrentrecommendedmethodtoworkaroundthislimitationin>DOMPDFisto"install"afontandenableUnicodesupport.OksoIhavetoinstallaunicode-font....doyouknowone,whichIcanuse(maybewithweb-address^^)?BrianSunread,Mar23,2010,10:16:00PM3/23/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfThefontdoesn'thavetofullysupportUnicode,itonlyneedstosupporthecharactersyouneed.DOMPDFworksinUnicodebecausethat'showyoucandefineextendedcharacterencodingsinPDFdocuments.Soyoushouldbeabletouseanyofyoursystemfonts.Ifyou'renotcomfortablesettingupthettf2ufmonyoursystemyoucantryouttheweb-basedfontpreptool:http://groups.google.com/group/dompdf/browse_thread/thread/9f7bc0162b04d5cfShamharothunread,Mar24,2010,5:29:31PM3/24/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfthxforanswer.Itriedtogenerateaczechfont(Idownloadedthefontfromhere:http://www.kwintessential.co.uk/fonts/czech/download.html-Font4)butwhenIgenerateanewPDFwithščřžýáíéIgoteverytime¹èø¾ýáíésothereisaproblemwiththe"invertedroof".SoItrieditwiththefontpackagefromMartinVšetičkafordompdf(http://www.martinvseticka.eu/index.php?sekce=browse&page=159)butthepdfiseverytimethesame.WhatdidImakewrong?Shamharothunread,Mar24,2010,6:27:52PM3/24/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfnowItrieditwithmeta-tagandwhenItrytogenerateapage,Igetthismessage:Catchablefatalerror:Argument1passedtoFrame_Decorator::copy()mustbeaninstanceofDOMNode,booleangiven,calledin/**my_path**/dev-czech/include/text_frame_decorator.cls.phponline132anddefinedin/**my_path**/dev-czech/include/frame_decorator.cls.phponline118AndsoonifIdecodethestring(utf8_decode)beforerenderingallsigneswithaninvertedroofwouldbechangedwithquestionmarks.MessagehasbeendeletedMessagehasbeendeletedShamharothunread,Mar24,2010,9:18:58PM3/24/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfmeagain....IpostagainbecauseIcan'tseethelightattheendofthetunnel:/nowItriedtouseafontfromfontspace(http://www.fontspace.com/red-hat-inc/liberation-sans)whichnormallysupportssymbolslike'č'.Icheckeditonline(it'spossibletotrythefontbytypingwordsinoneofthetextboxes)andItrieditwiththegnomefontviewer.Everytimeit'spossibletodisplaytheletters.Soiconvertedlocalwiththeload_font.php-script(withnofailures).(./php./load_font.phpliberation/..../LiberationSans-Regular.ttf/..../LiberationSans-Bold.ttf/..../Desktop/LiberationSans-Italic.ttf/...../LiberationSans-BoldItalic.ttf)ThenIchangedthedefaultfont(define("DOMPDF_DEFAULT_FONT","liberation");)andgeneratedatest-pdfwiththisphp-script:require_once("dompdf_config.inc.php");$html="ŠŘšžě";//$html=mb_convert_encoding($inhalt,"iso-8859-2","utf8");$inhalt=utf8_decode($html);$dompdf=newDOMPDF();$dompdf->load_html($html);$dompdf->render();$dompdf->stream("pdf_file.pdf");WhenIamusingmb_convert....theresultis"©Ø¹¾ì"andwhenIamusingutf8_decodetheresultis"?????"That's....really....strangeo_OBrianSunread,Mar25,2010,1:46:04AM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfOnMar24,9:09 am,Shamharothwrote:>nowItriedtouseafontfromfontspace(http://www.fontspace.com/red->hat-inc/liberation-sans)whichnormallysupportssymbolslike'č'.>Icheckeditonline(it'spossibletotrythefontbytypingwordsin>oneofthetextboxes)andItrieditwiththegnomefontviewer.>Everytimeit'spossibletodisplaytheletters.Ihaven'ttriedwithanyofthefontsyouspecified.Iam,however,abletouseVerdanafrommyownsystemandthecharactersdisplaycorrectly.>Soiconvertedlocalwiththeload_font.php-script(withno>failures).>(./php./load_font.phpliberation/..../LiberationSans->Regular.ttf/..../LiberationSans-Bold.ttf/..../Desktop/LiberationSans->Italic.ttf/...../LiberationSans-BoldItalic.ttf)>>ThenIchangedthedefaultfont(define("DOMPDF_DEFAULT_FONT",>"liberation");)and generatedatest-pdfwiththisphp-script:>>require_once("dompdf_config.inc.php");>$html="ŠŘšžě";>//$html=mb_convert_encoding($inhalt,"iso-8859-2","utf8");>$inhalt=utf8_decode($html);>$dompdf=newDOMPDF();>$dompdf->load_html($html);>$dompdf->render();>$dompdf->stream("pdf_file.pdf");>>WhenIamusingmb_convert....theresultis"©Ø¹¾ì"and>whenIamusingutf8_decodetheresultis"?????"OneoftheproblemshereisthatyouarenotsupplyingafullHTMLdocument.Itmaybethatevenwhenusingmb_convert_encoding()PHPisreportingthecharactersetofthestringincorrectlytoDOMPDF.Createafulldocumentincludingametatag.I'vetriedthisonmysystemanditappearstoworkcorrectly.Trysomethinglike:require_once("dompdf_config.inc.php");$html='ŠŘšžě
';$dompdf=newDOMPDF();$dompdf->load_html($html);$dompdf->render();$dompdf->stream("pdf_file.pdf");Iwoulddefinitelynotuseutf8_decode.Thatwill,essentially,takeanycharactersthatfalloutsidetheISO-8859-1charactersetandconvertthemto"?"...asyouhaveseen.Lastly,whichversionofDOMPDFareyouusing?DoyouhaveDOMPDF_UNICODE_ENABLEDsettotrue?Shamharothunread,Mar25,2010,3:56:16PM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfthxforyouranswerIwilltryyourcode.IamusinglinuxtoworksoIdon'treallyknowisthereaverdana-fontpreinstalled?sowhenItrytolocateit("locateverdana")theprogramfindsonlymydownloadedfont.toyourquestion:YesIsettheDOMPDF_UNICODE_ENABLEDtotrueandItrieditwithdompdf0.5.xandthe0.6beta.AtthemomentIaminstallingthebetaasecondtime(sowhentherewasaproblemwithmyfirstinstallationmaybeitsolvetheproblembyreinstalling).Shamharothunread,Mar25,2010,4:15:29PM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfNowItriedyourcode.AtfirstwhenIeditDOMPDF_DEFAULT_FONTthefontofthePDFdoesn'tchangeandwhenIexplizitsaythatthebody-taghasthefontliberation(it'sthefontwhichnormallycanŠŘšžě)theoutputchangesto:"??˜???žÄ›"(Sothereisž!its5%ofthetarget;))theentryofmyfontinthefont_family_cache-file:'liberation'=>array('normal'=>'/.../lib/fonts/LiberationSans-Regular','bold'=>'/.../lib/fonts/LiberationSans-Bold','italic'=>'/.../lib/fonts/LiberationSans-Italic','bold_italic'=>'/.../lib/fonts/LiberationSans-BoldItalic',),soIdon'tthinkthatthereistheproblem.Shamharothunread,Mar25,2010,5:07:43PM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfNowiinstalledaotherISO-8859-2-font(aTimes-Font)andtheproblemstillexists.NowwhenIgenerateapdfwiththesecondhalfvontheISOtable(the-2spacificchars)thefilehasalotof'?'again....NowIaddedthemp_convert...commandagainandthatstheresult:html-code:Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ
¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍ
ÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâă
äĺćçčéęëěíîďđňóôőö÷řůú
űüýţ˙
pdf-code:???¤??§¨Š???Ž?°???´???¸š????ž??ÁÂ?Ä??Ç?É?Ë?ÍÎ????ÓÔ?Ö×??Ú?ÜÝ?ß?áâ?ä??ç?é?ë?íî???óô?ö÷??ú?üý??SoitwouldbethebestwaytouseUTF-8,becausethenextweeksIhavetoaddtherussianfont,too.WhatcanIdotousealltheISO-8859-2-chars?BrianSunread,Mar25,2010,7:46:08PM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfOnMar25,4:15 am,Shamharothwrote:>NowItriedyourcode.AtfirstwhenIeditDOMPDF_DEFAULT_FONTthe>fontofthePDFdoesn'tchangeandwhenIexplizitsaythatthebody->taghasthefontliberation(it'sthefontwhichnormallycanŠŘšžě)>theoutputchangesto:>"??˜???žÄ›">(Sothereisž!its5%ofthetarget;))>theentryofmyfontinthefont_family_cache-file:>'liberation'=>> array(> 'normal'=>'/.../lib/fonts/LiberationSans-Regular',> 'bold'=>'/.../lib/fonts/LiberationSans-Bold',> 'italic'=>'/.../lib/fonts/LiberationSans-Italic',> 'bold_italic'=>'/.../lib/fonts/LiberationSans-BoldItalic',> ),>>soIdon'tthinkthatthereistheproblem.Thispathdoesn'tlooktobequiteright(e.g.itlookslikeit'spointingtothesystemrootthen/lib/fonts).Yourfontandthe*.afm/*.ufmfilesshouldallgoinyourdompdfinstallationfolderdompdf/lib/fonts.Youcanthenmakethearrayentrylooklikethis:'liberation'=>array('normal'=>DOMPDF_FONT_DIR.'LiberationSans-Regular','bold'=>DOMPDF_FONT_DIR.'LiberationSans-Bold','italic'=>DOMPDF_FONT_DIR.'LiberationSans-Italic','bold_italic'=>DOMPDF_FONT_DIR.'LiberationSans-BoldItalic')Shamharothunread,Mar25,2010,11:51:58PM3/25/10ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetodompdfthanksforallyouranswers!:)thisisstrange,becauseIdidn'tchangedthepathbymyself.SoIchangedallentriesto...=>DOMPDF_FONT_DIR.'...butit'sstilnotright.Thereisaverystrangethingto:whenIeditthedefaut-fontforexampletocourieranddon'tsetacss-styleforthebody-tag,thefontdoesn'tchangetocourierinthePDF.AndsoonIthinktheredomPDFdoesn'tuseeveryentryofthefont_family_cache-file.Icopied8fonts(czechcourier-reg,bold,italicandbolditalic(.afmand.pfa))intothe/lib/fontsfolderandaddedthisthefont_family_cache:'newcourier'=>array('normal'=>DOMPDF_FONT_DIR.'Cour','bold'=>DOMPDF_FONT_DIR.'Courb','italic'=>DOMPDF_FONT_DIR.'Couri','bold_italic'=>DOMPDF_FONT_DIR.'Courbd',),ButwhenItrytousethefontforthebody-tag(
Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ
¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍ
ÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâă
äĺćçčéęëěíîďđňóôőö÷řůú
űüýţ˙
Thequickbrownfoxjumpsoverthelazydog
';$html=mb_convert_encoding($html,"iso-8859-2","utf8");$dompdf=newDOMPDF();$dompdf->load_html($html);$dompdf->render();$dompdf->stream("pdf_file.pdf");ButwhenIdeletethe