MultiCell in FPDF PDF generator to add multiline text with auto ward wrap and increase the height

Поделиться
HTML-код
  • Опубликовано: 28 янв 2025

Комментарии • 38

  • @gundamizer4352
    @gundamizer4352 3 года назад

    Wow! what a Life saver!
    that's the simpliest and fastiest way to learn about the Multicell!
    Thank you so much!

    • @plus2net1
      @plus2net1  3 года назад

      Glad it helped!

    • @gundamizer4352
      @gundamizer4352 3 года назад

      @@plus2net1 Sir question why there is no changes when i use the "J" for justified.
      even if the LRT command in borders.

    • @plus2net1
      @plus2net1  3 года назад

      @@gundamizer4352 I don't think border has any thing to do with alignment, J will work when you have sufficient text to Justify the text within the borders, if less text is there it won't stretch upto right border. Try adding more text and see.

    • @gundamizer4352
      @gundamizer4352 3 года назад

      @@plus2net1 OH. thank you sir.
      in border parameters i put string between them.
      "LRT" (it works)
      last question sir
      there's a problem when i using two multicell() in one line.
      $x = $pdf->GetX();
      $y = $pdf->GetY();
      $pdf->Multicell(94, 5, $CN1, 1, 1);
      $pdf->SetXY($x + 94, $y);
      $pdf->Multicell(94, 5, $CN2, 1, 1);
      Their cells are not EQUAL.
      Sometimes:
      the first multicell is thin while the other is thick.
      pls help me :(
      cant wrap the words in a cell

    • @plus2net1
      @plus2net1  3 года назад

      Not clear to me , but try be removing SetXY(),

  • @wplearners8480
    @wplearners8480 Год назад

    may we apply multiple format on a single cell and apply border on it, like Title with bold format and in the new line mobile number without bold text?

    • @plus2net1
      @plus2net1  Год назад

      No, here you have to use multiple cells as we have to define font style size etc before using for each cell, one cell takes one type of options.

  • @brunomagnusjusto1010
    @brunomagnusjusto1010 Год назад

    How rotate the text in 90°? Help please

    • @plus2net1
      @plus2net1  Год назад

      Source code here .
      www.plus2net.com/php_tutorial/gd-imagettftext.php
      Video here,
      ruclips.net/video/rfJA9X5F-MU/видео.html
      More about imagettftext here
      ruclips.net/video/W0HhVKJmTVg/видео.html

  • @pacoexplorer
    @pacoexplorer 2 года назад

    Hello, how can I make the fields on the right of the multicell not be placed below the field that contains the multicell, I want them to remain horizontal, but when I use multicell they are placed below.
    Thanks

    • @plus2net1
      @plus2net1  2 года назад

      This will work in placing to the right .
      $y=$pdf->GetY();
      $x=$pdf->GetX();
      $w=60; // width of the MultiCell
      $pdf->MultiCell(w,10,'MultiCell 1st at x='.$x,LRTB,L,false);
      $x_second=$x+$w;
      $pdf->SetXY($x_second,$y);
      $pdf->MultiCell(w,10,'MultiCell 2 at x ='.$x_second,LRTB,L,false);
      Try but , I have to improve this

  • @Exoduse22
    @Exoduse22 2 года назад

    One thing I learned about multicell the hard way is that if the width value of the multicell is set smaller than a single letter/number, the program will infinitely keep running. I suppose it's due to the multicell continuously adding height to try accommodate the letter and make it fit in the cell. But if the width is fixed no amounts of height will make the letter fit so the program won't know what to do but to keep adding more height

    • @plus2net1
      @plus2net1  2 года назад

      You can read the last part of this page.
      www.plus2net.com/php_tutorial/pdf-multicell.php

  • @anycerollyseignoutiotsop7627
    @anycerollyseignoutiotsop7627 2 года назад

    Salut comment pourrait-on mettre une image en filigrane avec fpdf

  • @chrisworth88
    @chrisworth88 3 года назад

    Anyone any idea why I get 'FPDF' object has no attribute 'MultiCell' when I try to use it?

    • @plus2net1
      @plus2net1  3 года назад

      Just to check , is it giving any message for Cell() , The library is loaded properly ? Try other attributes and check.

    • @chrisworth88
      @chrisworth88 3 года назад

      @@plus2net1 pdf.cell() works perfectly but not so for pdf.MultiCell. I have installed FPDF using pip install FPDF and then assigned pdf=FPDF. Thanks so much

    • @plus2net1
      @plus2net1  3 года назад

      @@chrisworth88 You are working in Python ?

    • @plus2net1
      @plus2net1  3 года назад

      Not sure but try multi_cell() ,
      not tested in python, working in PHP only so far

    • @chrisworth88
      @chrisworth88 3 года назад

      @@plus2net1 you are a complete hero!! Yes I am working in Python and that was exactly the answer. Where did you find that? I had looked everywhere. Thank you so much.

  • @djjjozsi
    @djjjozsi 2 года назад

    thank you. very informative tutorial.

  • @businessidea3380
    @businessidea3380 2 года назад

    Vai mera munticen kam nai karrriya hai🤔🤔🤔🤔kiu ?
    Here below mycode:-
    MultiCell(60,10,'hello this is my first page that created by php fpdf','LRTB','L',false);
    Bato ge to mujhe help milchahiyega....

    • @plus2net1
      @plus2net1  2 года назад

      what is the error message you are getting ?

  • @ibrahimmallam9624
    @ibrahimmallam9624 3 года назад

    Thanks

  • @iwanyahya2214
    @iwanyahya2214 3 года назад

    how to auto text size? thanks before

    • @plus2net1
      @plus2net1  3 года назад

      Use $h variable to set the font size.
      $h=15; // default height of each MultiCell
      $w=100;// Width of each MultiCell
      $f=$h*0.75;
      $pdf->SetFont('Arial','B', $f); // Auto text size
      Now font size is 75% of the height of the autocell. You can read the full code with demo at the end of this page.
      www.plus2net.com/php_tutorial/pdf-multicell.php

    • @iwanyahya2214
      @iwanyahya2214 3 года назад

      @@plus2net1 ok, i try, thank you so much!

    • @iwanyahya2214
      @iwanyahya2214 3 года назад

      @@plus2net1 if the cell size remains, many letters can still be accommodated but the letters are smaller, and vice versa

    • @plus2net1
      @plus2net1  3 года назад +1

      @@iwanyahya2214 Using the height and width and length of the string to be displayed , one font size can be created. Check this example. Here as the number of text increases the font size is decreased.
      www.plus2net.com/php_tutorial/pdf-multicell-output-auto-text2.php
      The formula used is here. You can adjust this formula more by introducing number of lines you want to display.
      $cell_data="Welcome to plus2net, PHP section, read more on how to generate pdf documents here";
      $chars_no=strlen($cell_data);
      $f=0.75*($w/$chars_no)*($h/5);
      $pdf->SetFont('Arial','B',$f); // Auto text size
      $pdf->MultiCell($w,$h,$cell_data,LRTB,L,false);

  • @businessidea3380
    @businessidea3380 2 года назад

    Sir g please don't worry, 🙂🙏 but I'm facing problem to learn with your video, because you make your video in English 🥺🥺🥺😒😒😒😒😒😒😒 if possible please sir please make this in hindi 😒😒😒😒😒😒😒 please please please please 😒😒😒

    • @plus2net1
      @plus2net1  2 года назад

      I can speak Hindi, but not so good. I tried some Videos in Hindi also. Here towards end check the list.
      www.plus2net.com/php_tutorial/pdo.php
      But these are not so successful. Let us know if this much Hindi is OK for you to understand, I can speak better in Hindi so can help you in some live platforms.

  • @sathwikameenabad9789
    @sathwikameenabad9789 3 года назад

    Sir,I need your email..I have a doubt.I am stuck in middle of a project

    • @plus2net1
      @plus2net1  3 года назад

      www.plus2net.com/contactus.php