Jump to content

\n issue in php


atchua

Recommended Posts

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:
hello
again

but 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
Share on other sites

actually i am retrieving details from the database then i would store it on a variable

let'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
Share on other sites

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 net

just to reiterate, the confusing part here is that why in some machines it work but in others it doesn't

thanks for all the replies

Link to comment
Share on other sites

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
Share on other sites

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 anymore

thanks
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.