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 :) Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/ Share on other sites More sharing options...
feri_soft Posted September 1, 2006 Share Posted September 1, 2006 Try the function nl2br();?? Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83864 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 Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83872 Share on other sites More sharing options...
logu Posted September 1, 2006 Share Posted September 1, 2006 try \r\n instead of \n Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83877 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 Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83880 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() Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83885 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] Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83887 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? Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83895 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? Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83904 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. Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83910 Share on other sites More sharing options...
Jenk Posted September 1, 2006 Share Posted September 1, 2006 Which class are you using for $pdf? Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-83918 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 Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-85463 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. Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-85466 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 :) Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-85482 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. Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-85487 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 Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-85492 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 Link to comment https://forums.phpfreaks.com/topic/19327-n-issue-in-php/#findComment-86823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.