Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:50:13+00:00 2026-06-06T20:50:13+00:00

Hi i am using fpdf to generate pdf automatically to read data from sql

  • 0

Hi i am using fpdf to generate pdf automatically to read data from sql >since most of the content pulled from db it a paragraph of around 300words ..it not being wrapped by the columns i made in fpdf..it just goes as a single line..Is there any way to wrap the text with in the column .output image is attached at the end of the post..One more questain,how can i send this pdf to email automatically

   <?php

require('fpdf.php');

//Connect to your database
$link = mysql_connect('www.xxxxxxx.co.uk', 'xxxxxxx', 'xxxxxx');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

//Create new pdf file
$pdf=new FPDF();

//Open file
$pdf->Open();

//Disable automatic page break
$pdf->SetAutoPageBreak(true);

//Add first page
$pdf->AddPage();

//set initial y axis position per page
$y_axis_initial = 25;

//print column titles for the actual page
$pdf->SetFillColor(232, 232, 232);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetY($y_axis_initial);
$pdf->SetX(5);
/*$pdf->Cell(30, 6, 'CODE', 1, 0, 'L', 1);
$pdf->Cell(30, 6, 'NAME', 1, 0, 'L', 1);
$pdf->Cell(30, 6, 'PRICE', 1, 0, 'R', 1);*/

$y_axis = $y_axis + $row_height;


mysql_select_db("web39-sdasdasd", $link);
$q = "SELECT qr_topics,start_of,differential_dia,things_not,investigations,risks FROM qr_table";
$result = mysql_query ($q, $link);

//initialize counter
$i = 0;

//Set maximum rows per page
$max = 25;

//Set Row Height
$row_height = 80;
$pdf->Cell(33, 6, '  ', 1, 0, 'L', 1);
$pdf->Cell(33, 6, 'Starting off', 1, 0, 'L', 1);
$pdf->Cell(33, 6, 'Differential diagnosis', 1, 0, 'L', 1);
$pdf->Cell(33, 6, 'Not to miss', 1, 0, 'L', 1);
$pdf->Cell(33, 6, 'Investigations', 1, 0, 'L', 1);
$pdf->Cell(33, 6, 'Risks', 1, 0, 'L', 1);

$y_axis =(35);

while($row = mysql_fetch_array($result))
{


    $cad = $row['qr_topics'];
    $pad = $row['start_of'];
    $nad = $row['differential_dia'];
    $vad = $row['things_not'];
    $sad = $row['investigations'];
    $tad = $row['risks'];

    $pdf->SetY($y_axis);
    $pdf->SetX(5);
    $pdf->Cell(33,80,$cad,1,0,'L',1);
    $pdf->Cell(33,80,$pad,1,0,'L',1);
    $pdf->Cell(33,80,$nad,1,0,'L',1);
    $pdf->Cell(33,80,$vad,1,0,'L',1);
    $pdf->Cell(33,80,$sad,1,0,'L',1);
    $pdf->Cell(33,80,$tad,1,0,'L',1);

    //Go to next row
    $y_axis = $y_axis + $row_height;
    $i = $i + 1;
}

mysql_close($link);

//Send file
$pdf->Output();
?>

The output is shown below

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:50:14+00:00Added an answer on June 6, 2026 at 8:50 pm
    $row_height = 80;
    $pdf->Cell(33, 6, '  ', 1, 0, 'L', 1);
    $pdf->Cell(33, 6, 'Starting off', 1, 0, 'L', 1);
    $pdf->Cell(33, 6, 'Differential diagnosis', 1, 0, 'L', 1);
    $pdf->Cell(33, 6, 'Not to miss', 1, 0, 'L', 1);
    $pdf->Cell(33, 6, 'Investigations', 1, 0, 'L', 1);
    $pdf->Cell(33, 6, 'Risks', 1, 0, 'L', 1);
    

    Change from L to T or R

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using FPDF (generate PDF from PHP). I want to show all the items
I have some problem with inserting image when i generate pdf using FPDF library
I am using PHP and FPDF to generate a PDF with a list of
I'm working with generating .pdf's from PHP using this library: http://www.fpdf.org/ I am currently
I have code that generates PDF for me.I am using FPDF to generate PDF.sometimes
I generate PDF's using FPDF and I need to email it to a customer.
I'm using fpdf library to generate some pdf files with php. At this moment
I am using PHP and fpdf to generate my view in pdf. My problem
I am using php and fpdf to generate a pdf. How can I scale
I hava a PHP script which generates a PDF file (i'm using fpdf from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.