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 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
  • 1 View
  • 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

I have developed a web app using a webservice. Everything works fine in the
I have developed a PHP web app. I am giving an option to the
I am an iOS developer & developed a web services app which has been
I am trying to understand how to internationalize a web-app developed with emberjs. I
I am using eclipse to develop a java ee web app with Hibernate to
I have developed a web application using Netbeans 6.7 and Ant. The webapp works,
I have developed a small web app. This app allows users to upload images.
I am working on a PHP web app with another developer. We have 3
I have developed many web applications in ASP.NET in which I have make use
I am working on a web service for which we have already developed apps

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.