atchua Posted September 1, 2006 Share Posted September 1, 2006 i am working on how to create PDFs through PHP by importing the ezpdf class. the inserting of text in the PDF file works fine but the \n character is ignored thus making the text overlap each other. However, in some machines it works out fine and the \n character is applied. So i was just wondering if you are familiar with this problem? is this something to do with the configuration of the php (php.ini)?For example (coming from PHP):$pdf->ezText("hello\nagain", 12);the ideal display or output is:helloagainbut instead of displaying it, it ignores the \n character making the text overlap each other.hope someone could help me out with this, thanks in advance :) Quote Link to comment Share on other sites More sharing options...
feri_soft Posted September 1, 2006 Share Posted September 1, 2006 Try the function nl2br();?? Quote Link to comment Share on other sites More sharing options...
atchua Posted September 1, 2006 Author Share Posted September 1, 2006 already tried it but the "br" tag is written on the pdf as well. i'm guessing that it is with the configuration of PHP in each of the machines but not sure what it is should be changed in the configuration file Quote Link to comment Share on other sites More sharing options...
logu Posted September 1, 2006 Share Posted September 1, 2006 try \r\n instead of \n Quote Link to comment Share on other sites More sharing options...
atchua Posted September 1, 2006 Author Share Posted September 1, 2006 i just tried itl but no change still both \r\n are ignored and when br tag is used or inserted, it is also displayed or written on the PDF file. can this issue be resolved in php.ini file?thanks Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 1, 2006 Share Posted September 1, 2006 you might have magic_quotes_runtime() on, or if you aren't passing the value directly (i.e. from a form and in a variable) you may need to strip magic_quotes_gpc() Quote Link to comment Share on other sites More sharing options...
ludjer Posted September 1, 2006 Share Posted September 1, 2006 this is your best go[code]<?phpecho nl2br("hellowelcomebye");?>[/code]the out but into html should be somthing like this[code]hello<br>welcome<br>bye[/code] Quote Link to comment Share on other sites More sharing options...
atchua Posted September 1, 2006 Author Share Posted September 1, 2006 thanks for all the quick replywhen i checked my php.ini file, the setup is alreadymagic_quotes_gpc() = Onmagic_quotes_runtime() = Offmagic_quotes_sybase() = Offi cannot figure out what is wrong anymore? Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 1, 2006 Share Posted September 1, 2006 where is the value coming from? Are you inputting explicitly as per your example, or is the data coming from say the $_POST superglobal? Quote Link to comment Share on other sites More sharing options...
atchua Posted September 1, 2006 Author Share Posted September 1, 2006 actually i am retrieving details from the database then i would store it on a variablelet's say i would retrieve an id and name from the database and combine them into one string$string=id ."\n". name;after which i would use the string variable to write on the pdf using$pdf->ezText($string, 7);but after this process and when the pdf is streamed into php, the id and name overlap each other instead of the name placed on the next line on the pdf file created.i am running out of ideas because this same code when run in another server (with the same configuration and setup) actually works, meaning the id and name are separated and the newline character was applied. Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 1, 2006 Share Posted September 1, 2006 Which class are you using for $pdf? Quote Link to comment Share on other sites More sharing options...
atchua Posted September 4, 2006 Author Share Posted September 4, 2006 the classes that i used are class.ezpdf.php and class.pdf.php, wherein the class ezpdf extends the latter class. both classes are version 9 and were downloaded from the netjust to reiterate, the confusing part here is that why in some machines it work but in others it doesn'tthanks for all the replies Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 4, 2006 Share Posted September 4, 2006 try swapping to \r\n, and if still problematic try with just \r. Quote Link to comment Share on other sites More sharing options...
atchua Posted September 4, 2006 Author Share Posted September 4, 2006 still no luck, if \r\n is used the text overlaps but when \r alone is used it just writes/displays the text in one line.my guess is that the problem is already with the configuration or settings because the same scripts are used in different machines though not all display the desired appearance of the text on the PDF. of course, i'm still new with the ezpdf functionality.any other ideas will be greatly appreciated :) Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 4, 2006 Share Posted September 4, 2006 check encoding too, at a guess ezpdf will need UTF-8 - finding any docs for eZ is a pain so I can't verify. Quote Link to comment Share on other sites More sharing options...
atchua Posted September 4, 2006 Author Share Posted September 4, 2006 thanks, i'm already looking for a decent documentation on the ezpdf class Quote Link to comment Share on other sites More sharing options...
atchua Posted September 6, 2006 Author Share Posted September 6, 2006 i haven't found any descent documentation about ezPDF and if there are there were no details about special characters. i already tried using nl2br() and addslashes() but neither works. the first one makes the system also display the br tag while the latter has no effect to the string displayed meaning it has the same effect of text being overlapped to each other.any other ideas as to why this is so? cannot figure out what to do anymorethanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.