How to Wrap Cell's Content in PDF | PHP FPDF Tutorial #7

  Рет қаралды 47,764

GemaCode

GemaCode

Күн бұрын

EDIT : I have made a new tutorial about PDF table with cell wrapping abilities using multicell which is more efficient than this one. I recommend you to use that method instead. Please watch it here : • PDF Table with text wr...
welcome to the seventh chapter of PHP FPDF tutorial series.
in this chapter, i'm about to demonstrate how to handle overflowing text in PDF cells.
we will utilize and also explain GetStringWidth, SetFontSize and MultiCell method in this tutorial.
this time i'm about to explain two method of text wrapping.
font shrinking and multi cell.
font shrinking handle overflowing text by shrinking the font size until it fits in the cell.
this is the most simple method, this method keeps the height of every row equal.
but the downside is, it's only limited to text which is slightly longer than the cell.
longer than that, the text will become unreadable because it's too small.
compared to font shrinking, multi cell allows longer text without loss of readability.
but it's more complex and require more calculation.
Source code : bit.ly/3hYdT0F
More tutorial on this series : goo.gl/TNqTN4 (PHP PDF Tutorial Series)

Пікірлер: 139
@ukalistaxd9464
@ukalistaxd9464 9 ай бұрын
love that you provide visual explanation on how the logic works
@Sloarot
@Sloarot 2 жыл бұрын
It took me a while, but thanks to your fabulous explanation I think I've managed. thank you so much for this explanation. Unbelievable that such an important part is not explained on the website of free pdf itself!
@eldjennemo2122
@eldjennemo2122 4 жыл бұрын
Hi, This tutorial is really interesting and, above all, the explanations are extremely clear. No doubt I gonna use this method in my web applications developpement. Thx a lot !
@arjuntr7985
@arjuntr7985 3 ай бұрын
Thank you. I was able to tackle the same problem in python Fpdf.
@riyazuddinsh
@riyazuddinsh 6 жыл бұрын
I will never gonna unsubscribe your channel man. You are the best bro. But I am having 10 columns in which two column name and email needs to fit in the column.
@vesselincohen437
@vesselincohen437 5 жыл бұрын
Thank you for all good tutorials you made! I learned a lot from you!
@debashishmishra9309
@debashishmishra9309 6 жыл бұрын
Your Tutorials are Awesome!!
@kundukandanfamily
@kundukandanfamily 23 күн бұрын
thanks, this video was really helpful
@houarirechache9147
@houarirechache9147 Жыл бұрын
thanks so much you solved a big problem i had
@ahsankhanrokhri1489
@ahsankhanrokhri1489 4 жыл бұрын
Good and clear information. JizakAllah..
@sachinadi88
@sachinadi88 4 жыл бұрын
Thanks a lot... Much needed and helpful
@shameemn
@shameemn 6 жыл бұрын
Hi, This was very helpful.. just something I found useful in case of MultiCell if the input text has new line characters then we will not get the exact line numbers hence it will be good to also check for if(strstr($tmpString, PHP_EOL)) $continueWhile = false; and include $continueWhile in the $tmpString while loop.
@shameemn
@shameemn 6 жыл бұрын
You are most welcome and your video's have been really helpful. Please continue the great stuff!
@vhorhat17
@vhorhat17 6 жыл бұрын
Where do you put this code?
@shameemn
@shameemn 6 жыл бұрын
I used it something like this... $continueWhile = true; while($startChar < $textLength){ while(($pdf->GetStringWidth($tmpString) < ($cellWidth-$errMargin) && ($startChar+$maxChar) < $textLength) && $continueWhile){ $maxChar++; $tmpString=substr($inputString, $startChar, $maxChar); if(strstr($tmpString, PHP_EOL)){ $continueWhile = false; } } $continueWhile = true; $startChar += $maxChar; array_push($textArray, $tmpString); $maxChar = 0; $tmpString = ""; } $line = count($textArray);
@Desdroyer24
@Desdroyer24 5 жыл бұрын
is there a way to make this for multiple rows? I mean, you make this only for the row "item[2]" but almost always there is more than one row that overflows
@josepolo9585
@josepolo9585 Жыл бұрын
hola, como lo conseguiste?
@aguilardiego84
@aguilardiego84 3 жыл бұрын
Gracias, funcionó muy bien!
@pmrakibulhasan635
@pmrakibulhasan635 3 жыл бұрын
thank you. amazing tutorial and well documented
@GemaCode
@GemaCode 3 жыл бұрын
Thank you very much for the feedback. :)
@reynaldiarytumanan1199
@reynaldiarytumanan1199 Жыл бұрын
I'm having trouble in multicell when the text contains enter, causing the wrap text is not complete. What's the solution to this problem? thank you
@suharyadi2957
@suharyadi2957 6 жыл бұрын
mantap tutorial nya gan
@F3RC4O
@F3RC4O 2 жыл бұрын
Pues me funcionó, bastante útil.
@tugrulyldrm5699
@tugrulyldrm5699 3 жыл бұрын
very cool
@antonioarjonesbello807
@antonioarjonesbello807 5 жыл бұрын
Hi bro, thx so much, u solved my life!
@danisupriyadi_lampung
@danisupriyadi_lampung 4 жыл бұрын
Tutorial bagus, terimakasih
@rozaimizamahri9604
@rozaimizamahri9604 6 жыл бұрын
Hi, How to make other column response the cellheight like the column 2 does ? your code only works for single column only. Appreciate if you can help us . Thanks
@rozaimizamahri9604
@rozaimizamahri9604 6 жыл бұрын
Thank you for the reply. I'll give it a try :)
@rozaimizamahri9604
@rozaimizamahri9604 6 жыл бұрын
Hi, I manage to wrap the text inside the cell table using this references www.fpdf.org/en/script/ex3.pdf, But I have two (2) problems which is : 1. How to align specific column 2. How to create side by side table with database value Here's the link for the question stackoverflow.com/questions/52402231/fpdf-multicell-how-to-align-specific-cell-in-fpdf-using-php Can you help me out at solve the question number 1 ? I posted the question on stackoverflow. Hope you can view and help me . Thanks
@rozaimizamahri9604
@rozaimizamahri9604 6 жыл бұрын
It's okay. :) . Already found the solution using TCPDF .Thanks btw . Cheers
@rogermezz
@rogermezz 6 жыл бұрын
hi, can you help me. I need to export two tables in the same report but when i execute the while the second table is insert in down cells, how i make to insert next to the first table?
@carriep7812
@carriep7812 4 жыл бұрын
I have ingested a wealth of knowledge form these Gemul Channel videos - so thank you, but this one was a miss. I was not able to get this to work, sadly.
@pimudithawickramasekara2187
@pimudithawickramasekara2187 3 жыл бұрын
excelent
@WTFMoment88
@WTFMoment88 8 ай бұрын
how to use this method to my profile data fetch form mysql
@rushrun21
@rushrun21 6 жыл бұрын
Thanks Gemul Channel !
@hikmetgumus2821
@hikmetgumus2821 3 жыл бұрын
Hello, how can we adjust the table size? I am trying to make two tables on the page and make it one subtable. Thank you
@chendraoe2710
@chendraoe2710 2 жыл бұрын
Thank you so much !
@juancarlosgomezperez5288
@juancarlosgomezperez5288 6 жыл бұрын
muchas gracias me srivio de mucho
@tmssweb4683
@tmssweb4683 7 жыл бұрын
Thank you very much. I am waiting with eagerness for this tutorial. can you help me about show database image in cell in FPDF.
@karthikhanasi6052
@karthikhanasi6052 6 жыл бұрын
hi, I am not able to get the lines as expected like if first line has 3 lines but the first line overlapping to the next lines. If the last line has 3 or 4 lines that time the line is expanding any solution or i am missing anything.
@karthikhanasi6052
@karthikhanasi6052 6 жыл бұрын
Hey, I am accessing data from the database and using a while loop for that and using your code and you have foreach loop with manual input array any solution for that.
@digadget
@digadget 5 жыл бұрын
there is possible to wrapping image on cell ?
@Hades2023
@Hades2023 7 жыл бұрын
Thank you! Gemul.
@lazymacs2823
@lazymacs2823 3 жыл бұрын
nc tutorial
@GemaCode
@GemaCode 3 жыл бұрын
Thank you! :)
@suleimangaitho2686
@suleimangaitho2686 6 жыл бұрын
hello,this is pretty useful,could i get a copy of the code? Thanks man.
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
hello,i'm a bit late but kindly bare with me. am trying to run your code but experiencing an error exception titled array to string conversion on the fpdf file, how do i solve that?
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
the php tells me that the error is on the pdf file,which i doubt,let me try convert the array am supposed to print on the pdf to a string and see if it works
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
no success,can i send you part of the code so you can highlight where i've gone wrong
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
or rather send me the source code to opiyotobias9@gmail.com
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
thank you,your channel isnt accessible,do you have tuitorial on creating a pdf where the tables overlap in more than one page
@tobiasopiyo4522
@tobiasopiyo4522 6 жыл бұрын
it has helped but i'm getting this php error while using class PDF extends FPDF, the error says class declarations may not be nested, how can i solve that?
@Brancoec
@Brancoec 6 жыл бұрын
Hi, can you please help me? Tried your code source using mysql but I'm only getting the first row of it can you help me out on that?
@Brancoec
@Brancoec 6 жыл бұрын
here's my email branco.ec@gmail.com, if you need I can send you the code I tried to modify, this is what I'm looking for, realy appreciate your tuto, thanks.
@Brancoec
@Brancoec 6 жыл бұрын
Done great, it was not well done my query, You just saved my day, thanks a lot, you'r the man.
@Brancoec
@Brancoec 6 жыл бұрын
Do you know a way to vertically align text in cells to the top, in case a this example of yours my left and right cells are item number and item quantity, so when text are wrapped both cells stays vertically centered ? Thanks in advance.
@Brancoec
@Brancoec 6 жыл бұрын
Many thanks, I will give it a try, thanks for looking for it
@raginishrivastava3615
@raginishrivastava3615 7 жыл бұрын
very nice but background music should be slow...... not able to listen voice properly
@tomassarmiento4857
@tomassarmiento4857 6 жыл бұрын
hey bro, how do I modify the structure of the table?
@kevinhernandezarango5005
@kevinhernandezarango5005 5 жыл бұрын
does this work in Tcpdf?
@vijaytallolli
@vijaytallolli 4 жыл бұрын
How to the same with Multiple Multicell Height
@sadenlav
@sadenlav 6 жыл бұрын
How to add unicode font for support another language
@sadenlav
@sadenlav 6 жыл бұрын
Cambodia
@sadenlav
@sadenlav 6 жыл бұрын
no problem
@kowsalyag481
@kowsalyag481 4 жыл бұрын
Hello.please upload how to display image in PDF from database
@dannarchiejabilles973
@dannarchiejabilles973 6 жыл бұрын
If 1 cell is more than 1 page. how it looks like? thank you.
@dannarchiejabilles973
@dannarchiejabilles973 6 жыл бұрын
can you try doing it please? make 1 cell data longer than 1 page. not the cell is more than 1 page but the data inside the cell is more than 1 page. thank you.
@ellhnkouvelis6421
@ellhnkouvelis6421 7 жыл бұрын
hi excellent but in python don't have
@erzascarlet2145
@erzascarlet2145 4 жыл бұрын
can you please post up the code.
@parmanandkushwah5494
@parmanandkushwah5494 6 жыл бұрын
hello please send me a source code of this PDF report
@parmanandkushwah5494
@parmanandkushwah5494 6 жыл бұрын
thanks this video is my very-very help full and thanks-a-lot........
@carl2np
@carl2np 6 жыл бұрын
hello thank you for this tutorial can i get the source code please
@carl2np
@carl2np 6 жыл бұрын
carl2np@gmail.com
@carl2np
@carl2np 6 жыл бұрын
thanks a lot i just get it
@carl2np
@carl2np 6 жыл бұрын
please how can i do the same with database please
@lizbethpina4254
@lizbethpina4254 6 жыл бұрын
hello you can send me your source code?.... please
@lizbethpina4254
@lizbethpina4254 6 жыл бұрын
lizbth1301@gmail.com
@kaushalverma4386
@kaushalverma4386 4 жыл бұрын
its too much difficult
@chathurikaedirisinghe2337
@chathurikaedirisinghe2337 6 жыл бұрын
can you send me the source code
@chathurikaedirisinghe2337
@chathurikaedirisinghe2337 6 жыл бұрын
Ok.thanx
@ekavenifenariyati5237
@ekavenifenariyati5237 6 жыл бұрын
Gan, boleh saya minta source code nya ngak? email saya ekavenifena@gmail.com .terima kasih atas bantuannya..
@IrwanKurniawan45
@IrwanKurniawan45 5 жыл бұрын
Tutorial yang sangat bermanfaat, kalau boleh saya juga mau minta source code nya. kirim ke email saya boyimam67@gmail.com . terima kasih
@ridhozahtra2194
@ridhozahtra2194 6 жыл бұрын
selamat siang, kebetulan saya juga mengalami masalah dengan wraptext saat membuat laporan pdf. kalau boleh saya juga mau minta source code nya. kirim ke email saya ridhozahtra@gmail.com . terima kasih
@BryanPratisia
@BryanPratisia 6 жыл бұрын
Tutorial yang sangat membantu sekali, saya mendapat sedikit masalah dalam penyesuaian border dalam tabel agar dapat mengikuti isi yang ada pada tabel. tapi saya masih sedikit bingung dengan tutorial melalui video. boleh saya meminta source code nya? email saya bryan.pratisia16@gmail.com. terima kasih atas bantuannya
@kaushalverma4386
@kaushalverma4386 4 жыл бұрын
it
@denylowprime3118
@denylowprime3118 7 жыл бұрын
Sangat bermanfaat. Gan, bisa kirim source codenya ke email saya denylowprime@gmail.com. Thx
@ridhozahtra2194
@ridhozahtra2194 6 жыл бұрын
selamat siang, kebetulan saya juga mengalami masalah dengan wraptext saat membuat laporan pdf. kalau boleh saya juga mau minta source code nya. kirim ke email saya ridhozahtra@gmail.com . terima kasih
@yusupsupriatna922
@yusupsupriatna922 5 жыл бұрын
Boleh minta source code nya ka ? emailnya yusupsupriatna712@gmail.com terima kasih ka
@yusupsupriatna922
@yusupsupriatna922 5 жыл бұрын
@@GemaCode sip terimakasih ka , ka apakah ada yang buat untuk ke excelnya juga ???
@yusupsupriatna922
@yusupsupriatna922 5 жыл бұрын
belum ka, bentar saya coba cari
How to Make A Pie Chart in PDF | PHP FPDF Tutorial #8
8:28
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 126 МЛН
How To Merge Cells in PDF | PHP FPDF Tutorial #2
11:28
GemaCode
Рет қаралды 32 М.
"I Hate Agile!" | Allen Holub On Why He Thinks Agile And Scrum Are Broken
8:33
Microsoft 365 Copilot: Wave 2 | Microsoft September 2024 Event
27:39