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

  • Home
  • SEARCH
  • 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 855309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:03:20+00:00 2026-05-15T08:03:20+00:00

In a web app developed in PHP we are generating Quotations and Invoices (which

  • 0

In a web app developed in PHP we are generating Quotations and Invoices (which are very simple and of single page) using TCPDF lib.

The lib is working just great but it seems to generate very large PDF files. For example in our case it is generating PDF files as large as 4 MB (+/- a few KB).

How to reduce this bloating of PDF files generated by TCPDF?

Here is code snippet that I am using

ob_start();
                include('quote_view_bag_pdf.php'); //This file is valid HTML file with PHP code to insert data from DB
                $quote = ob_get_contents();  //Capture the content of 'quote_view_bag_pdf.php' file and store in variable

                ob_end_clean();

                //Code to generate PDF file for this Quote
                //This line is to fix a few errors in tcpdf
                $k_path_url='';


                require_once('tcpdf/config/lang/eng.php');
                require_once('tcpdf/tcpdf.php');

                // create new PDF document
                $pdf = new TCPDF();

                // remove default header/footer
                $pdf->setPrintHeader(false);
                $pdf->setPrintFooter(false); 

                // add a page
                $pdf->AddPage();

                // print html formated text
                $pdf->writeHtml($quote, true, 0, true, 0); //Insert Variables contents here.

                //Build Out File Name
                $pdf_out_file = "pdf/Quote_".$_POST['quote_id']."_.pdf";

                //Close and output PDF document
                $pdf->Output($pdf_out_file, 'F');
                $pdf->Output($pdf_out_file, 'I');
                ///////////////
enter code here

Hope this code fragment will give some idea?

  • 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-15T08:03:21+00:00Added an answer on May 15, 2026 at 8:03 am

    Finally I have managed to solve the problem.

    The problem was that by mistake I had inserted a link to email id in the web page that was getting rendered to PDF. By just removing this link the size of the generated PDF went down to just 260 kb!

    Thanks everyone who tried to help me out in solving this problem.

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

Sidebar

Related Questions

A few years ago I developed a web app for which we wanted to
We are about to develop a web app from scratch using ASP.Net, and would
In my (PHP) web app, I have a part of my site that keeps
I've been experimenting with Adobe Flex recently. Being a long-time server-side web app developer,
When I hire developers for general mid-to-senior web app development positions, I generally expect
I have a huge web app that is having issues with memory leak in
we're developing a web app to cover all aspects of a printing company from
I've got a web app that sends out emails in response to a user-initaited
I have a new web app that is packaged as a WAR as part
I have a webapp development problem that I've developed one solution for, but am

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.