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 899823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:17:12+00:00 2026-05-15T15:17:12+00:00

I have generated a pdf using fpdf library. The datas are exported to pdf

  • 0

I have generated a pdf using fpdf library. The datas are exported to pdf document i want to set the width of the indivijual column cells how to do that
i know some thing has to be done here in this function to increase the width
function CalcWidths($width,$align)
{
//Compute the widths of the columns
$TableWidth=0;
foreach($this->aCols as $i=>$col)
{
$w=$col['w'];
if($w==-1)
$w=$width/count($this->aCols);
elseif(substr($w,-1)=='%')
$w=$w/100*$width;
$this->aCols[$i]['w']=$w;
$TableWidth+=$w;
}
if($align=='C')
$this->TableX=max(($this->w-$TableWidth)/2,0);
elseif($align=='R')
$this->TableX=max($this->w-$this->rMargin-$TableWidth,0);
else
$this->TableX=$this->lMargin;
}

what has to be changed

  • 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-05-15T15:17:12+00:00Added an answer on May 15, 2026 at 3:17 pm

    Width can be assigned the fpdf like this,

     $options = array('cols' =>
                            array('Detail1' => array('width'=>100, 'justification' => 'left'),
                                  'Detail2' => array('width'=>400, 'justification' => 'left')
                                 )
                           );
    

    But the field values extends then width also increases. Then use like this

    $table[] = array(
                    array("Detail1" => "D1", "Detail2" => wordwrap($x1, 200, "\n", 1)),
                    array("Detail1" => "D2", "Detail2" => wordwrap($x2, 200, "\n", 1)),
                    array("Detail1" => "D3", "Detail2" => wordwrap($x3, 200, "\n", 1))
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with inserting image when i generate pdf using FPDF library
I have generated a pdf file with password protection by using the following code:
I'm using pylons to serve a dynamically generated pdf document for reporting: my approach
I have successfully generated password protected pdf using xsl fo from apache foundation's fop
I have a method that generates a PDF file using Reportlab library: def obtenerPDFNuevoPedido(self,
I have code that generates PDF for me.I am using FPDF to generate PDF.sometimes
I'm using fpdf library to generate some pdf files with php. At this moment
I have a PDF that is being generated from HTML source using HTMLDOC. While
I have generated a pdf using iTextSharp, when its created it saves automatically in
I have been using XSL-FO and FOP Engine to generate PDF documents for required

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.