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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:45:21+00:00 2026-05-27T23:45:21+00:00

I am trying to create PDF file using DOM pdf and Codeigniter. I have

  • 0

I am trying to create PDF file using DOM pdf and Codeigniter. I have the following script in my Controller and I have kept the DOM folder inside my controller . But when I run the script I get fatal error message.

But when I send a value from my model to DOMPDF’s $html which is in my controller .. I can generate the pdf.

Could you please kindly help me how to get rid of this error?

    include_once('dompdf/dompdf_config.inc.php'); 
    $html= $this->load->view('view_pdf');
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_paper("a4", "landscape" ); 

    $dompdf->render();
    $dompdf->stream("my_pdf.pdf", array("Attachment" => 0));   

This is my View File ;

<html>
 <head>
<style>
    #header { position: absolute; left: 0; top: -50px; right: 0; height: 140px; text-align:  center;  }
    #footer {position: fixed ; left: 0px; bottom: -20px; right: 0px; height: 30px; font-size:10; }
    #footer .page:after { content: counter(page, upper-roman); }


        #table-6 {
        width: 100%
        border: 1px solid #B0B0B0;
        }
        #table-6 tbody {
        /* Kind of irrelevant unless your .css is alreadt doing something else */
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        font-size: 100%;
        vertical-align: baseline;
        background: transparent;
        }


        #table-6 td {
        padding: 3px 10px;
        font-size: 12px;
        font-weight: normal;
        text-align:center;
        }
        #table-6 tr:nth-child(even) {
        background: #F2F2F2;
        font-size: 12px;
        font-weight: normal;
        }




 </style>

  </head>

    <body>


     This is a test 
    </body>

    </html>
  • 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-27T23:45:21+00:00Added an answer on May 27, 2026 at 11:45 pm

    According to the CodeIgniter documentation on views you have to modify your call to load->view() so that the data is returned as a string to the controller rather than pushed to the web browser. Try modifying your controller code as follows:

    include_once('dompdf/dompdf_config.inc.php');
    $html= $this->load->view('view_pdf','',true);
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_paper("a4", "landscape" );
    
    $dompdf->render();
    $dompdf->stream("my_pdf.pdf", array("Attachment" => 0));
    

    The only change I made was to add the necessary parameters to $this->load->view().

    (I don’t use CodeIgniter. Do any CI users have anything to add?)

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

Sidebar

Related Questions

I am trying to create a PDF file using struts 2.Action class location is
I'm trying to generate a PDF file using AJAX call in Rails3. The following
Trying to create a PDF file based on an XML and a file using
I'm trying to write metadata to a pdf file using the following python code:
Hello I'm trying to create grouping in the pdf file and I have to
Ok so I am trying create a login script, here I am using PHP5
I'm trying to create a method that will send a PDF file directly to
I'm trying to embed a PDF file into a Word document using the OLE
Using Mac OS X API, I'm trying to save a PDF file with a
I'm trying to generate a pdf file from data in a database using JasperReports

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.