Line breaks

Benjamin
2009-04-17
2012-12-04
  • Benjamin

    Benjamin - 2009-04-17

    Hi ,

    to start working with the PDF class i decided to test it.
    and i created the following:
    A page with a textarea
    and a button

    after filling the textarea with text and pressing the button it should generate a PDF with the text
    from the textarea, it does fill the PDF with the text,
    the only problem is that line breaks are being ignored.
    My code looks as following:

    <?php
        include("class.pdf.php");
    ?>
    Create a PDF
    <?php
    if($_SERVER['REQUEST_METHOD'] == 'POST'){
          if (!isset($demotext) || strlen($demotext)==0){
         $demotext = htmlspecialchars($_POST['tekstveld']);
          }
            $pdf = new Cpdf(array(0,0,598,842));
            $x=600;                                    //breedte
            $y=800;                                    // hoogte
            $size=12;                                // lettertype groote
            $pdf->addText(10,$y,$size,$demotext);    // tekst wordt hier op de breedte positie toegevoegt
            $pdf->stream();
            }
    ?>
    <form id="form1" name="form1" method="POST" action="">
          <p>
            <label>
              <textarea name="tekstveld" id="tekstveld" cols="45" rows="5" ></textarea>
            </label>
          </p>
          <p>
            <input type="submit" value="Omzetten" name="omzetten"  />
          </p>
    </form>

     
    • Bron Squire

      Bron Squire - 2009-04-22

      Hi,

      Did you manage to resolve this issue with EZPDF?  I am having a similar issue, here line breaks are being ingored, even if they would be caused by wrapping text.

      Thanks,
      Bron

       
  • caglaror

    caglaror - 2009-09-25

    Hi,
    Is there enyone who solved this problem with ezPdf clearly? I am just being envolved with ezPDF. Try to write here if have any good solution.
    Thanks
    Caglar

     
  • Anonymous - 2009-09-26

    Hi Caglar,

    I guess you can solve it very easy. Just by doing a quick replace of all &quot;\n&quot; chars into &quot;&amp;lt;br /&amp;gt;&quot;s

     
  • caglaror

    caglaror - 2009-09-28

    I think the new class chenged something that exclude html tags. ezTextAdv() cant read html tags.

     
  • caglaror

    caglaror - 2009-09-28

    As the same way function ezText($text,$size=0,$options=array(),$test=0)
    Some new functions added. At the end of following function inside functions i found the responsible function:
    function ezProcessText($text){
      // this function will intially be used to implement underlining support, but could be used for a range of other
      // purposes
      $search = array('&lt;u&gt;','&lt;U&gt;','&lt;/u&gt;','&lt;/U&gt;');
      $replace = array('&lt;c:uline&gt;','&lt;c:uline&gt;','&lt;/c:uline&gt;','&lt;/c:uline&gt;');
      return str_replace($search,$replace,$text);
    }

    So should i replace raw texts into html tags to get html or inline css stylings?

     
  • Anonymous - 2009-09-29

    I think you can also use callback functions to handle all other html tags (excl. &amp;lt;b&gt;, &amp;lt;i&gt; and &amp;lt;u&gt;).

    But are you sure that it was working before or didn't  I understand correct?

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks