FPDI New line after ... characters

nielsv

I'm creating an FPDI PDF. This is what I do now:

libraries_load('fpdi');

$pdf = new FPDI();  

$path = drupal_get_path('theme', 'xmed') . '/docs/verkocht_template.pdf';

$pdf->setSourceFile(realpath($path)); 
$tplIdx = $pdf->importPage(1, '/MediaBox');

$pdf->addPage();
$pdf->useTemplate($tplIdx, 0, 0, 210);

$path = drupal_get_path('theme', 'xmed') . '/fonts/lato.php';

$pdf->AddFont('lato-light-webfont','','lato-light-webfont.php');
$pdf->SetFont('lato-light-webfont', '', 14);
$pdf->SetTextColor(0, 0, 0);

$pdf->SetXY(47, 71);
$pdf->Write(0, $name);

I'm also placing some other variables on my PDF. This is the result now:

enter image description here

But as you can see the $name variable is to long... . I've tried this:

$naam = wordwrap($naam, 20);

But that gave me this result:

enter image description here

What would be the best solution to fix this?

Jan Slabon

Simply use MultiCell() instead of Write(). It allows you to define a width (1st parameter) on which the text will be wrapped automatically.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Slovak characters in Fpdi

From Dev

Android TextView - Add A New Line After Every 20 Characters

From Dev

Android TextView - Add A New Line After Every 20 Characters

From Dev

Insert new line after various amount of numeric characters

From Dev

Count characters in line after first grep result, but removing new line from count

From Dev

Getting a list with new line characters

From Dev

Hidden new line characters in string?

From Dev

remove line is no characters after delimiter

From Dev

strategy to fprintf into a file from a buffer but going to a new line after every 100 characters?

From Dev

Sed: Append text containing new lines characters after the first line of a file

From Dev

How can I make a string jump to a new line after a certain number of characters in PDFsharp?

From Dev

New line after the command prompt

From Dev

New line after <li> bullet

From Dev

Replacing new line characters with literal '\n' in macvim

From Dev

Add new line characters (\n) into CSV file?

From Dev

RegEx to remove new line characters and replace with comma

From Dev

Split string by whitespaces removes new line characters

From Dev

Is there a specific way to input characters at the beginning of a new line?

From Dev

UIActivityViewController not passing new line characters to some activities

From Dev

regex to highlight new line characters in the beginning and end

From Dev

regex to highlight new line characters in the beginning and end

From Dev

Can sed replace new line characters?

From Dev

Replacing new line characters with literal '\n' in macvim

From Dev

Regex: Match everything between characters or new line

From Dev

sed replace special characters with new line on Linux

From Dev

How to escape new line characters for json?

From Dev

New line characters in apache error log

From Dev

How to Backspace New Line Characters in Notepad++

From Dev

How to introduce new line characters with iTextSharp

Related Related

  1. 1

    Slovak characters in Fpdi

  2. 2

    Android TextView - Add A New Line After Every 20 Characters

  3. 3

    Android TextView - Add A New Line After Every 20 Characters

  4. 4

    Insert new line after various amount of numeric characters

  5. 5

    Count characters in line after first grep result, but removing new line from count

  6. 6

    Getting a list with new line characters

  7. 7

    Hidden new line characters in string?

  8. 8

    remove line is no characters after delimiter

  9. 9

    strategy to fprintf into a file from a buffer but going to a new line after every 100 characters?

  10. 10

    Sed: Append text containing new lines characters after the first line of a file

  11. 11

    How can I make a string jump to a new line after a certain number of characters in PDFsharp?

  12. 12

    New line after the command prompt

  13. 13

    New line after <li> bullet

  14. 14

    Replacing new line characters with literal '\n' in macvim

  15. 15

    Add new line characters (\n) into CSV file?

  16. 16

    RegEx to remove new line characters and replace with comma

  17. 17

    Split string by whitespaces removes new line characters

  18. 18

    Is there a specific way to input characters at the beginning of a new line?

  19. 19

    UIActivityViewController not passing new line characters to some activities

  20. 20

    regex to highlight new line characters in the beginning and end

  21. 21

    regex to highlight new line characters in the beginning and end

  22. 22

    Can sed replace new line characters?

  23. 23

    Replacing new line characters with literal '\n' in macvim

  24. 24

    Regex: Match everything between characters or new line

  25. 25

    sed replace special characters with new line on Linux

  26. 26

    How to escape new line characters for json?

  27. 27

    New line characters in apache error log

  28. 28

    How to Backspace New Line Characters in Notepad++

  29. 29

    How to introduce new line characters with iTextSharp

HotTag

Archive