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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:55:04+00:00 2026-06-16T22:55:04+00:00

I have created and successfully created my pdf file in php with fpdf library

  • 0
  • I have created and successfully created my pdf file in php with fpdf
    library support.

  • But the problem is my footer is showing more space.

  • I want to reduce the space underneath my text. My output is like
    this:
    output

Here my code goes:

<?php
    require('fpdf/fpdf.php'); 
    class PDF extends FPDF {


                function Header() {
                            $this->SetY(0.208333);
                        }
                function Footer() {
                                 if ($this->footer <> 1)
                                 {
                                $this->SetY(-15);
                             }
                             else
                             {
                                echo "bye";
                             }
                        }
    }

                        //class instantiation
                        $pdf=new PDF("l","in",array(8.5,4.17));
                            $pdf->SetFont('Arial','',8);
                            $pdf->footer = -15;
                            //Array2
                            $datas = array
                                    (
                                    'Address1' => array
                                    (
                                    'Name' => 'Vijaya',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    'Address2' => array
                                    (
                                    'Companyname' => 'Vy Systems',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    'Address3' => array
                                    (
                                    'Companyname' => 'Vy Systems1',
                                    'Area' => 'Valasaravakkam1',
                                    'City' => 'Chennai1',
                                    ),
                                    );
                            //Array2
                            $datas1 = array
                                    (
                                    'Address4' => array
                                    (
                                    'Name' => 'Jaya',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    );

                            foreach($datas1 as $address1 => $details1)
                            {
                                //pdf_set_text_pos($pdf, 1240, 490);
                                //$pdf->ln(1);

                                    foreach($datas as $address => $details)
                                    {
                                        $pdf->SetMargins(0,0,0.3);
                                        $pdf->AddPage();
                                        if((is_array($details)) and (is_array($details1)))
                                        {
                                            foreach($details1 as $rows1 => $value1)
                                            {
                                                $pdf->SetX(0.520833);
                                                $pdf->MultiCell(0, 0.2, $value1, 0, "L");
                                            }
                                            $pdf->ln(1.96);
                                            foreach($details as $rows => $value)
                                            {
                                                $pdf->SetX(5);
                                                $pdf->MultiCell(5, 0.2, $value, 0, "L");
                                            }
                                        }

                                    }//end of sub foreach
                            }//end of main foreach

                        $pdf->Output();
?>
  • 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-16T22:55:05+00:00Added an answer on June 16, 2026 at 10:55 pm

    I didn’t follow the code completely, but it seems you’re using the Header and Footer methods to set Y and nothing more, expecting that to be enough to correctly position the MultiCells being output outside of the Header and Footer. Maybe so, but the interaction of positioning inside and outside the Header/Footer isn’t well defined.

    For example, the process may be something like this: Y is calculated for the MultiCell, that trips the footer, the footer changes Y, the MultiCell is output. Is this the original Y, the revised (by the footer Y), or some other value? Absent a precise definition of what happens, you’ve set up a complex sequence of things that would be very difficult to sort out.

    I would suggest vastly simplifying the code. You may find that the automatic header/footer tripping isn’t helpful at all. In that case, turn off the auto page break, get rid of the Footer/Header functions, and totally control each page yourself. That way at least you have a clear, reliable model of what’s going on.

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

Sidebar

Related Questions

I have created downloadable product in magento 1.7. it created successfully but it showing
i have successfully created distribution profiles and installed on my xcode organiser, but this
I have successfully created an app that reads from a bundled .plist file and
I have successfully created an email that sends on creation of a Kase, but
I have successful created a pdf file on a website. What I would like
I have created a .proto file and the ProtoBufTool successfully created .cs file. I
I have created a pdf file and I am storing it in my local
I have created a Scalar Functions, it was created successfully, but when I call
When i write file, File created successfully, but next time when i read same
I have successfully created a feature in sharepoint that modifies the existing edit dialog

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.